Results 1 to 9 of 9

Thread: [RESOLVED] Resizing pictures in a folder....

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Resolved [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
    - ØØ -

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    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
    My Blog.

    Ryan Jones.

  3. #3
    Member AWC_Joe's Avatar
    Join Date
    Jan 2006
    Location
    Located
    Posts
    49

    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.
    |
    Some programs and scripts ive made: http://wiki.anotherwebcom.com
    What was once an opinion, became a fact, to be later proven wrong...

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Resizing pictures in a folder....

    Quote 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.


    - ØØ -

  5. #5
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Resizing pictures in a folder....

    Quote 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
    My Blog.

    Ryan Jones.

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Resizing pictures in a folder....

    I think I found the problem now.


    - Did as AWC_Joe said. Opened it up took the pen and drew some nice stuff on it and saved it again. Still didn't work.

    - Opened it up, resized it from 1600x1200 ->1024x768. Then it worked

    - Opened it up, resized it from 1024x768 -> 1600x1200. Then it didn't work...


    SO guess there is some size limit here somewhere.. Not sure where though...


    - ØØ -

  7. #7

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Resizing pictures in a folder....

    Quote 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

  8. #8

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    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?


    - ØØ -

  9. #9

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    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
  •  



Click Here to Expand Forum to Full Width