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
Posts: 974
Did you say Rasputin?
Are you using Imagemagick, by any chance?
Posts: 8
Yes, i see that the app convert is in /usr/X11R6/bin (as is defaulted in G2)
Why? Should i use some other program?
Posts: 974
No, nothing wrong with ImageMagick - at least on *nix.
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.
Posts: 8
Where should i add this parameter? (yes, i've Linux)
But is this helping 'shrinking' the thumbnail?
Posts: 8
Yep, this will help.. now my file is much smaller (3,1kb).. But in which file should i add this parameter?
Posts: 8601
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
Posts: 974
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.
Posts: 3236
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
Posts: 8
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!
Posts: 7985
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.
Posts: 8
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..
Posts: 8
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?
Posts: 8601
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.
Posts: 8
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!
Posts: 8601
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.