slideshow not working properly

This is the place to discuss bugs that have been found in the most recent version of PivotX. Posting bugs will ensure that the Development Team is aware of them and that they will be addressed when resources are available.

Re: slideshow not working properly

Postby ljhelbo » Sun Mar 13, 2011 8:10 pm

Well, I feel I am getting closer to an understanding, though not completely ;)

Firstly I really cant see, how anything should have been messed up here. I am not using any kind of FTP. I have the server here under my desk and access it via LAN. I also see the extra linebreak now; but if I remove it (with UltraEdit) and then save the file with a jpg-ending, it will not open as an image - wrong file format something.

I have one change however. I had to leave out the .htaccess. If I use the example coming with PivotX, I get an internal server error 500.

However, i just discovered one interesting thing. The thumbnails actually are created. I found them in the folder PivotX/db/cache/thumbnails but they are files in png-format and with random numbers (like 3d268ac9fd46376e95b12f9591571f6f.png ). I can not open them in PhotoShop. I get the error message "Could not complete your request because the file-format module cannot parse the file". But Picasa Photo Viewer opens them with no problems.

This just gave me an idea. I tried to rename these files to jpg, and now they also open in PhotoShop. In other words, they are jpg-files with a wrong file-extension.
ljhelbo
 
Posts: 104
Joined: Sat Feb 26, 2011 2:58 pm
Location: Denmark

Re: slideshow not working properly

Postby hansfn » Sun Mar 13, 2011 8:15 pm

@Harm: If you are upgrading, you should of course select 2.2.5 - my point was that a site already upgraded to 2.2.4 is safe.

Since I don't have FTP access to Lars' site, I can't say for sure that there is an empty line in the beginning of pivotx/includes/timthumb.php but I'm quite sure since the output from pivotx/includes/timthumb.php is a valid JPEG file except for the first empty line ;-)

@Lars: The files in db/cache/thumbnails/ are completely irrelevant. That they are created improves speed, but it's not related to your problem of displaying the file. (They are named "whatever.png" no matter what image type it is.) Please just check includes/timthumb.php for an empty line break (or space) in the beginning.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: slideshow not working properly

Postby ljhelbo » Sun Mar 13, 2011 9:29 pm

Yes, I also see the extra linebreak at the beginning of the file. Still I find the images in the cache interesting, because they are almost identical. If I compare the "image" shown to the one in the cache, there are two diferences. The image shown has an extra linebreak at the beginning. The file in the cache has an extra "FF D9" at the very end. Apart from this the two files are identical. And the file in the cache is a valid JPG-image - just the way it should be.

To me it looks as if the thumbnail is being created the way it should, but when it is to be shown on the screen, it is copied with an offset, which is two bytes wrong.
ljhelbo
 
Posts: 104
Joined: Sat Feb 26, 2011 2:58 pm
Location: Denmark

Re: slideshow not working properly

Postby hansfn » Sun Mar 13, 2011 10:00 pm

Lars, please listen to me. The cache is irrelevant. They files there are created by includes/timthumb.php and hence are almost identical to the output. The difference is because of what I have tried to tell you several times - there is a (leading) line break or space in the file includes/timthumb.php.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: slideshow not working properly

Postby ljhelbo » Mon Mar 14, 2011 8:58 am

I know, I was just trying to figure out, how and where this extra linebreak is inserted. As the thumb in the cache is correct, I assume that the error happens, when the thumb is shown - not when it is created. I also notice that the linebreak (two bytes) are not simply added. At the very end of the file, another two bytes are being cut off, so the total size of the file is the same. This might give a clue on the type of error.

But never mind - first of all i will now upgrade to 2.2.5 to see if this makes any change.
ljhelbo
 
Posts: 104
Joined: Sat Feb 26, 2011 2:58 pm
Location: Denmark

Re: slideshow not working properly

Postby hansfn » Mon Mar 14, 2011 9:17 am

Lars, I know the space/linebreak is introduced in the beginning of includes/timthumb.php so please check that file very carefully. If it isn't in that file, it's caused by a linebreak/space in some of the files included by it. Try replacing
Code: Select all
include_once "../lib.php";

with
Code: Select all
echo 'x';
include_once "../lib.php";
echo 'x';die;

inside includes/timthumb.php and then try the URL i posted above. If you get a line break/space between the x's you know the problem is with lib.php (and it's includes). If not, the problem is with includes/timthumb.php.

PS! Upgrading might fix the problem, but that is by accident. It's better to not upgrade, and try to understand what is going on. Nothing has changed with includes/timthumb.php in 2.2.5.

PS! Seriously, please stop wasting time on the cache.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: slideshow not working properly

Postby ljhelbo » Mon Mar 14, 2011 9:53 am

OK, there was no linebreak between the x'es
ljhelbo
 
Posts: 104
Joined: Sat Feb 26, 2011 2:58 pm
Location: Denmark

Re: slideshow not working properly

Postby hansfn » Mon Mar 14, 2011 2:19 pm

Great, then you know that includes/timthumb.php is to blame. So have you check (the beginning of) the file carefully (with an editor that doesn't hide stuff from you)? You just need to find very the line break/space is produced - you can move the die('x') statement further and further down the code until the line break appears before the x (if your editor doesn't help you).
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: slideshow not working properly

Postby ljhelbo » Tue Mar 15, 2011 11:32 am

OK, will try that. I leave
echo 'x';
in line 35 of timthumb.php and move down
echo 'x'; die;

If I move it down to line 117, I still get an output of "x x" with no line-break in between.

Then I move it down to line 120. Just below the line:

check_cache ($cache_dir, $mime_type);

Now something happens. If the thumbnail is available in the cache-folder, it is shown. But with the extra line-break at the beginning of the image-file (and thus not displaying the image, as it should be, but rather an image of the URL). This image covers the x'es, so they are not visible. If I make sure that the cache-folder is empty, I still get "x x".

I continue to move down and place echo 'x'; die; in line 142. The behaviour is the same. If the cache (sorry for mentioning the C-word :oops: ) is empty I get "x x". If the thumbnail is available in the cache, it is displayed with an inserted line-break at the beginning of the file.

Starting at line 143 comes a long procedure, which creates the thumbnail in the cache. It goes down to line 330. This procedure is only called, if the thumbnail is not available in the cache. In that case it will create the thumbnail in the cache. When this is done, it will take the newly created thumbnail from the cache and show it on screen (line 369).

So, if I place my echo 'x'; die; in line 377 and empty the cache, a new thumbnail is created in the cache and is afterwards shown with an inserted line-break on screen. However, there is nothing wrong with the thumbnail in the cache. Therefore the line-break must be inserted in the part of the procedure, which displays the image - not the part that creates the image.

This makes me believe that the error must be in the function show_cache_file, which starts at line 573. This function is called from line 369 and from line 119 (indirectly through the function check_cache). This would explain why the same error happens in these two different parts of the script, depending on whether the thumbnail is available in the cache or not.

It would also explain something else. On the page http://www.frijsendal.dk/?p=test you can see that the thumbnail is being displayed as it should in the fancybox (but not in the gallery). In both cases the thumbnail was created the same way (with timthumb.php), but it is being read for display in two different ways. For fancybox it is being read from the Images-folder, for the slideshow it is being read from the cache.

Alternatively the problem would have to be in widget-slideshow.php, probably around line 276
ljhelbo
 
Posts: 104
Joined: Sat Feb 26, 2011 2:58 pm
Location: Denmark

Re: slideshow not working properly

Postby hansfn » Tue Mar 15, 2011 12:12 pm

The output should be "xx", not "x x". So maybe the problem is related to lib.php after all. You can talk about the cache as mush as you want, but your are wasting your (and mine) time.

PS! http://www.frijsendal.dk/images/slideshow/0.thumb.jpg isn't created by timthumb.php (unless you manually moved the file from db/cache/thumbnails/). The thumb.jpg files are created either automatically on upload or manually using the PivotX image cropper. It's irrelevant anyway.
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

PreviousNext

Return to 2.x Bugs

Who is online

Users browsing this forum: No registered users and 2 guests

cron