|
-
Feb 21st, 2006, 05:45 AM
#1
[RESOLVED] Resizing pictures in a folder....
I have done this before, but now somethign is seriously wrong. I made a script looking something like this (shortened a bit):
Code:
if ($width > 500){
$less = $width - 500;
$prosent = 1.0 - ($less / $width);
$new_h = round($prosent * $height);
$thumb = imagecreatetruecolor(500,$new_h);
imagealphablending($thumb, false);
$source = imagecreatefromjpeg("$cfg_fullsizepics_path/$entry");
imagecopyresampled($thumb, $source, 0, 0, 0, 0, 500, $new_h, $width, $height);
$filename="$cfg_fullsizepics_path/$entry" . "_thumb.jpg";
@imagejpeg($thumb, $filename);
}
I tested the script on all pictures in a folder where I have pictures from my phone, Visuals camera, and Mendhaks camera. But for some reason it works on pictures from my phone, Mendhaks camera, but NOT pictures from Visuals Camera. Anyone any idea. I have highlighted the line where the scripts stops. It gomes to that line when it handles a picture from Visuals camera, and then just stops there.
Any ideas? Any fallbacks I can use?
Thanks
- ØØ -
-
Feb 21st, 2006, 08:03 AM
#2
Re: Resizing pictures in a folder....
Do you get any actual errors from the script or does it just not work?
My suggestion is check that the pth its trying to read is corrext and check that the extensions match that required by the function 
Cheers,
Ryan Jones
-
Feb 22nd, 2006, 01:39 AM
#3
Member
Re: Resizing pictures in a folder....
Maybe it has somthing to do with the Header info Visuals Camera puts in the jpeg file? Maybe try and save one of them pics with an image editor and see if it still happens.
-
Feb 22nd, 2006, 06:15 AM
#4
Re: Resizing pictures in a folder....
 Originally Posted by sciguyryan
Do you get any actual errors from the script or does it just not work?
My suggestion is check that the pth its trying to read is corrext and check that the extensions match that required by the function
Cheers,
Ryan Jones
Since it works with the other pictures I can't see that the extensions should be missing or wrong version. Nor the path.
- ØØ -
-
Feb 22nd, 2006, 06:20 AM
#5
Re: Resizing pictures in a folder....
 Originally Posted by NoteMe
Since it works with the other pictures I can't see that the extensions should be missing or wrong version. Nor the path.
- ØØ -
Hmm... it is an interesting problem.
Any chance you can post a link tothe page?
Are you shure its that line?
Try removing the "@" infront of the imagejpegfunction and see if it returns anything that may be of use, also did it generate and rror log to say somethiin was wrong?
Cheers,
Ryan Jones
-
Feb 22nd, 2006, 06:36 AM
#6
-
Feb 22nd, 2006, 06:40 AM
#7
Re: Resizing pictures in a folder....
 Originally Posted by sciguyryan
Try removing the "@" infront of the imagejpegfunction and see if it returns anything that may be of use, also did it generate and rror log to say somethiin was wrong?
Guess I found out why when I took away the @..
same4.jpg #####################################################
Width: 1600 . Heigth: 1200
New W: 500 . New H: 375
Done 1
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 6400 bytes) in /data/kunde/inet/www/002661/nordics.ch/update/insert_pictures.php on line 98
-
Feb 22nd, 2006, 06:41 AM
#8
Re: Resizing pictures in a folder....
When I think about this....Isn't 16Mb it says there? Am I not freeing up memory somewhere? Maybe that is the reason? Or is the image just too big?
- ØØ -
-
Feb 22nd, 2006, 07:51 AM
#9
Re: Resizing pictures in a folder....
And once again, VisualAD helped me on way. I just changed the amount of memory my script is allowed to use. So now it works..
i.e:
PHP Code:
ini_set("memory_limit", "32M");
- ØØ -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|