1.3.1 timthumb bug re-implemented?

A forum for Bolt related questions / issues

1.3.1 timthumb bug re-implemented?

Postby ningus » Mon Nov 25, 2013 6:16 pm

Hello there,
with Bolt 1.2.1 there was a problem with thumbnails being not shown especially on 1&1 webspace. I found a solution in github here:
https://github.com/bolt/bolt/commit/089787d562e0a0a820e8c39e8874f03e320118cd

Now in 1.3.1 it is again that thumbnails being not shown like above on 1&1 webspace. It seems that while a fix is included in the new timthumb, it is still necessary to switch the order of REQUEST_URI and REDIRECT_URL to make thumbnails work.

I don't know if this a unique case....
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: 1.3.1 timthumb bug re-implemented?

Postby Bob » Sun Dec 01, 2013 1:36 pm

I did recently revert these, because of this: http://stackoverflow.com/questions/6483 ... equest-uri

We had a site, where the images didn't show up in IE 8 and IE 9, because the browser didn't set the headers properly. Is it possible for you to do a var_dump for $_REQUEST for a case like this? There has to be some way to make them both work. :-/

If possible, post it here, too: https://github.com/bolt/bolt/issues/733
Bob
Lead Developer
 
Posts: 1374
Joined: Tue Nov 20, 2007 11:16 pm

Re: 1.3.1 timthumb bug re-implemented?

Postby ningus » Mon Dec 02, 2013 3:30 pm

Is it possible for you to do a var_dump for $_REQUEST for a case like this?


Bob, how do I do that? Must admit that I’m more or less a front-end dev, not sure how far I could be of help.

You mentioned a site with images not showing up in IE8-9. I just checked my site with reverted timthumb and so far no problems in IE8, wasn’t able to check IE9 though.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: 1.3.1 timthumb bug re-implemented?

Postby ningus » Wed Dec 04, 2013 1:39 pm

Ok, here we go. I put this
Code: Select all
{{ print(image.filename|thumbnail()) }}
...into the image loop.

And the correct paths for thumbnails show up. Like this:
Code: Select all
    … String(53) => /thumbs/240x160resize/2013-09/bandfoto-aktuell-09.jpg

    … String(53) => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg

    … String(53) => /thumbs/240x160resize/2013-09/bandfoto-aktuell-06.jpg

So far, so good. With standard timthumb (bolt 1.3.1) no images are shown though. To make the thumbnails show up I need to patch the timthumb like mentioned in the first post.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: 1.3.1 timthumb bug re-implemented?

Postby Bob » Wed Dec 04, 2013 5:28 pm

The problem is not in the path that's generated (as shown by your example.. It's the way timthumb handles the request.

I'll see if I can tweak timthumb.php, and we'll put it through some rigorous testing to get it right once and for all.. :-)
Bob
Lead Developer
 
Posts: 1374
Joined: Tue Nov 20, 2007 11:16 pm

Re: 1.3.1 timthumb bug re-implemented?

Postby ningus » Wed Dec 04, 2013 6:01 pm

Thank You!!

BTW on my local dev-machine (rather oldish Apache 2.2.15 / PHP 5.3.3) it doesn´t matter in which order REQUEST_URI and REDIRECT_URL are – or if there is only one of each declared.

From above Stackoverflow discussion it seams that REQUEST_URI is preferable, but on newer servers it may be a different story.
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: 1.3.1 timthumb bug re-implemented?

Postby Bob » Sat Dec 07, 2013 10:31 am

I'm still trying to figure out why it won't work on your setup.. Could you try the following?

- Make sure there is _no_ 'thumbs/' folder in the root of your site. If there is, rename or remove it temporarily.
- Verify the part for thumbnails in your .htaccess is correct. It should be:

Code: Select all
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^thumbs/(.*)$ ./app/classes/timthumb.php [L]


- Edit the file app/classes/timthumb.php, change the start to:

Code: Select all
<?php

echo "<pre>";
print_r($_REQUEST);
print_r($_SERVER);
die();



- Then, in your browser, directly go to one of the images, like example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg and post the output here.
Bob
Lead Developer
 
Posts: 1374
Joined: Tue Nov 20, 2007 11:16 pm

Re: 1.3.1 timthumb bug re-implemented?

Postby ningus » Sat Dec 07, 2013 11:22 am

This is the output. I obscured some paths in it, hope it’s still meaningful....
Code: Select all
Array
(
    [bolt_session] => 6bfeedbf0b378f65d1cb83778d184055
)
Array
(
    [REDIRECT_REDIRECT_UNIQUE_ID] => UqMBugouBMAAAGX2UIkAAAAW
    [REDIRECT_REDIRECT_SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_REDIRECT_SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_REDIRECT_DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [REDIRECT_REDIRECT_UI_SUEXEC_FSTATD_UNIXSOCKET] => /var/run/ui-fstatd.suexec.socket
    [REDIRECT_REDIRECT_STATUS] => 200
    [REDIRECT_UNIQUE_ID] => UqMBugouBMAAAGX2UIkAAAAW
    [REDIRECT_SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [REDIRECT_UI_SUEXEC_FSTATD_UNIXSOCKET] => /var/run/ui-fstatd.suexec.socket
    [REDIRECT_HANDLER] => x-mapp-php6
    [REDIRECT_STATUS] => 200
    [UNIQUE_ID] => UqMBugouBMAAAGX2UIkAAAAW
    [DBENTRY_HOST] => example.org
    [DBENTRY] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example:d0000#CPU 20 #MEM 61440 #CGI 786762 #NPROC 10 #TAID 48876071 #WERB 0 #LANG 0 #PARKING 1 #STAT 1
    [SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [HTTP_HOST] => example.org
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_COOKIE] => bolt_session=6bfeedbf0b378f65d1cb83778d184055
    [HTTP_CONNECTION] => keep-alive
    [PATH] => /bin:/usr/bin
    [SERVER_SIGNATURE] =>
    [SERVER_SOFTWARE] => Apache
    [SERVER_NAME] => example.org
    [SERVER_ADDR] => 212.227.192.251
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => XX.XXX.XX.XX
    [DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [SERVER_ADMIN] => webmaster@example.org
    [SCRIPT_FILENAME] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example/app/classes/timthumb.php
    [REMOTE_PORT] => 62477
    [REDIRECT_URL] => /app/classes/timthumb.php
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] =>
    [REQUEST_URI] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [SCRIPT_NAME] => /app/classes/timthumb.php
    [STATUS] => 200
    [ORIG_PATH_INFO] => /app/classes/timthumb.php
    [ORIG_PATH_TRANSLATED] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example/app/classes/timthumb.php
    [PHP_SELF] => /app/classes/timthumb.php
    [REQUEST_TIME_FLOAT] => 1386414522.9794
    [REQUEST_TIME] => 1386414522
    [argv] => Array
        (
        )

    [argc] => 0
)
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Re: 1.3.1 timthumb bug re-implemented?

Postby Bob » Sun Dec 08, 2013 1:44 pm

This is very helpful.. Could you try a potential fix for me?

The issue is that "REDIRECT_URL" exists, but it contains the name of the script, not the requested path to the file. It ought to be fixed for you with this additional check:

Code: Select all
if (!empty($_SERVER['REDIRECT_URL']) && (strpos($_SERVER['REDIRECT_URL'], 'timthumb.php') === false)) {
    $requesturi = $_SERVER['REDIRECT_URL'];
} else {
    $requesturi = $_SERVER['REQUEST_URI'];
}
Bob
Lead Developer
 
Posts: 1374
Joined: Tue Nov 20, 2007 11:16 pm

Re: 1.3.1 timthumb bug re-implemented?

Postby ningus » Sun Dec 08, 2013 2:25 pm

This didn’t work. No thumbnails.
The $_REQUEST output looks very similar.
Code: Select all
Array
(
    [bolt_session] => 9a87bfef94551bde3d34b6b07ce13ccb
)
Array
(
    [REDIRECT_REDIRECT_UNIQUE_ID] => UqR@8AouBMAAAHPlEjwAAAAv
    [REDIRECT_REDIRECT_SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_REDIRECT_SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_REDIRECT_DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [REDIRECT_REDIRECT_UI_SUEXEC_FSTATD_UNIXSOCKET] => /var/run/ui-fstatd.suexec.socket
    [REDIRECT_REDIRECT_STATUS] => 200
    [REDIRECT_UNIQUE_ID] => UqR@8AouBMAAAHPlEjwAAAAv
    [REDIRECT_SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [REDIRECT_DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [REDIRECT_UI_SUEXEC_FSTATD_UNIXSOCKET] => /var/run/ui-fstatd.suexec.socket
    [REDIRECT_HANDLER] => x-mapp-php6
    [REDIRECT_STATUS] => 200
    [UNIQUE_ID] => UqR@8AouBMAAAHPlEjwAAAAv
    [DBENTRY_HOST] => example.org
    [DBENTRY] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example:d0000#CPU 20 #MEM 61440 #CGI 786762 #NPROC 10 #TAID 48876071 #WERB 0 #LANG 0 #PARKING 1 #STAT 1
    [SCRIPT_URL] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [SCRIPT_URI] => http://example.org/thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [HTTP_HOST] => example.org
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:25.0) Gecko/20100101 Firefox/25.0
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    [HTTP_ACCEPT_LANGUAGE] => de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_COOKIE] => bolt_session=9a87bfef94551bde3d34b6b07ce13ccb
    [HTTP_CONNECTION] => keep-alive
    [HTTP_PRAGMA] => no-cache
    [HTTP_CACHE_CONTROL] => no-cache
    [PATH] => /bin:/usr/bin
    [SERVER_SIGNATURE] =>
    [SERVER_SOFTWARE] => Apache
    [SERVER_NAME] => example.org
    [SERVER_ADDR] => 212.227.192.251
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => XX.XXX.XX.XXX
    [DOCUMENT_ROOT] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example
    [SERVER_ADMIN] => webmaster@example.org
    [SCRIPT_FILENAME] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example/app/classes/timthumb.php
    [REMOTE_PORT] => 62683
    [REDIRECT_URL] => /app/classes/timthumb.php
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] =>
    [REQUEST_URI] => /thumbs/240x160resize/2013-09/bandfoto-aktuell-05.jpg
    [SCRIPT_NAME] => /app/classes/timthumb.php
    [STATUS] => 200
    [ORIG_PATH_INFO] => /app/classes/timthumb.php
    [ORIG_PATH_TRANSLATED] => /kunden/homepages/XX/XXXXXXXXXX/htdocs/example/app/classes/timthumb.php
    [PHP_SELF] => /app/classes/timthumb.php
    [REQUEST_TIME_FLOAT] => 1386512112.304
    [REQUEST_TIME] => 1386512112
    [argv] => Array
        (
        )

    [argc] => 0
)
ningus
 
Posts: 34
Joined: Fri Jun 21, 2013 4:05 pm
Location: Europe

Next

Return to Bolt Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron