Big thumbnail

tofra

Joined: 2004-08-12
Posts: 8
Posted: Thu, 2004-08-12 22:14

Hi!

I've installed G2, and it looks much better than G1! My compliments!
But, i noticed one (strange) thing. My album contains a couple of pictures. When i'm viewing it, i see 9 thumbnails on my screen (this is the default). It takes a couple of seconds to load the thumbs, i've discoverd that the thumbs are quite big! Al of them are at about 130kb. This is large, because if i'm saving it with another program, it is only about 10kb..

Where should i look what is causing the big thumbs?

Regards,
Tom

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Thu, 2004-08-12 22:28

Did you say Rasputin?

Are you using Imagemagick, by any chance?

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Fri, 2004-08-13 10:05

Yes, i see that the app convert is in /usr/X11R6/bin (as is defaulted in G2)
Why? Should i use some other program?

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Fri, 2004-08-13 15:54

No, nothing wrong with ImageMagick - at least on *nix.

ImageMagick wrote:
The '+profile "*"' removes any ICM, EXIF, IPTC, or other profiles that might be present in the input and aren't needed in the thumbnail

Unfortunately, this doesn't play nice with Windows - or least that was how I understood the bug to evidence itself.

Perhaps we could include a jhead module to strip the headers out of files on windows.

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Fri, 2004-08-13 20:10

Where should i add this parameter? (yes, i've Linux)
But is this helping 'shrinking' the thumbnail?

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Fri, 2004-08-13 21:00

Yep, this will help.. now my file is much smaller (3,1kb).. But in which file should i add this parameter?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2004-08-13 21:28

There is a G2 task to fix this, so it will get done eventually.
The code change will likely be in modules/imagemagick/classes/ImageMagickToolkit.class

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Fri, 2004-08-13 21:31

This would have to be added to the Imagemagick module in G2, and I'm just guessing about the cause. Some cameras put 70K of exif data (and a thumbnail) in the jpegs that they produce.

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Fri, 2004-08-13 22:49

Ohhhh, that would explain something about my camera actually.

I can rotate the picture so I can view it on the camera correctly... but when I download the photo it is not rotated. I bet it is rotating the thumbnail stored in the jpg itself.

Thanks for the info :)

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Sat, 2004-08-14 12:15

jmullan, i've tried to find which function creates the thumbnail. But it's not in the ImageMagick module (modules/imagemagick/classes/ImageMagickToolkit.class). Because if i'm adding exit; at the top of the file, the thumbnail is still showing.
Do you have a hint where i should whatch? (because loading a page is now, more then 1MB, and people with a slow connection.... well, you know.. :-))

Thanks!

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7985
Posted: Sat, 2004-08-14 19:15

The thumbnails are created once and cached so that we don't use system resources to create them every time somebody wants to see them.

The easiest to fix this is to just blow away your cached images by removing everything under the g2data/cache/derivative directory.

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Sat, 2004-08-14 23:07

Thanks bharat, that was indeed the problem.. But now I've been testing for about 2 hours, and i didn't figured out (jet!) to get it working. Then i have square thumbs instead of normal size, then i have the default picture (looks like a broken glas) etcetc.. But i'll tackle this.. :-) It just takes some time..

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Sun, 2004-08-15 12:28

I don't get it, tried a couple of things. Just before executing the command, i added:
$fp=fopen("/tmp/tom.txt","a");
foreach($command as $v) {
fwrite($fp,$v."\r\n"); }
fclose($fp);
list($success, $output) = $platform->exec(array($command));
This gives me the output:
/usr/X11R6/bin/convert
-quality
75
-scale
150x150
+profile
'*'
/www/www.getactive.nl/gallery2/g2data/albums/HPIM2379_001.JPG
/www/www.getactive.nl/gallery2/g2data/tmp/imgk_o6MQJp

The result is an image, but still 140kb. If i put the +profile at the beginning (so the first line is /usr/X11R6/bin/convert +profile '*') i get the defaulted image (broken glass). If i execute this command manually, then i get an image which is 4kb.
Help? :-)

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-08-15 16:52

Try just putting +profile * in the code. I think the exec() command will wrap each argument in quotes... I ran a command line test and confirmed that:
convert ..... "+profile" "'*'" ....
leaves the exif data in the resulting file.

 
tofra

Joined: 2004-08-12
Posts: 8
Posted: Sun, 2004-08-15 20:35

Great! This worked, apparently it puts everything between quotes. (but i don't know why, i can find where it is doing that, line 392?).
For everybody who want's to use this, add the following line after line 93:
/* fall through to scale */
$transform = array('-scale', $parameters[0] . 'x' . $parameters[
0],'+profile','*');
break;

Thanks everybody for helping!

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2004-08-15 21:51

I put that code into CVS.. thanks.
Now can somebody test that on windows?

We could add the +profile '*' thing for other operations too except we don't know when we might be doing an operation on the original image without preserving the original.. in that case we would want to keep the metadata... so I put in the code to only affect thumbnails, as you have done.