Menu

Thumbs fail to be generated

Help
Kristian
2011-04-22
2013-05-30
  • Kristian

    Kristian - 2011-04-22

    Having problems uploading pics to PGV.

    Main problem seem to be that thumbs can't be generated. Don't know why though. The only error echoed is "failed to be generated" (my translation).

    When user tried to upload pic, the file is transferred to server; it's found in media/ folder. No file with same name in media/thumbs though.

    media/thumbs has permissions 777.
    PHP (version 5.3.6) is compiled -with-gd; GD version "2.0.34 compatible". JPEG support enabled, libJPEG version 8.

    File to be uploaded is JPEG.

    I've even tried setting "Create thumbnails" to no in config, but I still get the same error about thumbnails not being able to be created.

    Nothing relevant shown in server logs.

    What might be wrong? How can I troubleshoot?

    Any tips greatly appreciated!

     
  • Kristian

    Kristian - 2011-04-22

    Oh, and PGV version 4.3.0 svn -- up to date SVN; checked out earlier today.

     
  • Stephen Arnold

    Stephen Arnold - 2011-04-22

    Krisse
    Two things -
    1) Permissions on the THUMB folder?
    2) Memory?  What size are your original images? As previously posted, even recently, it takes an extraordinary amount of memory to create thumbnails as it is accomplished by decompressing the main image in memory, reading the entire main image into memory, then in memory cache, manipulating that image (resizing) and then writing it to disk. Remember that a 1mb jpg may be as large as 15mb decompressed, and this process would required about 40mb of memory by itself.

    As a side note, next time, please use the search function to see if you can locate relevant posts to your question before posting a question that has been answered perhaps a dozen times. Doing so would demonstrate respect for the time devoted by the volunteers on these forums.
    -Stephen

     
  • Gerry Kroll

    Gerry Kroll - 2011-04-22

    We have posted often enough that PhpGedView should not be used as a picture archive that stores images in sufficiently high quality to produce posters.  The Media feature is intended to enhance the Genealogy information that is central to the purpose of the program.

    As a general rule, I never store images larger than roughly 500 px high or wide as the "main" image.  There are a few exceptions to this general rule, such as paintings, where someone might wish to examine the signature of the painter.  You can't do this with low-resolution images. 

    Pictures that originally are only 500 px high or wide would usually result in JPG files of around 50 to 80 Kb.  PGV has no problems creating thumbnails for these, as long as there's enough memory.  If the memory were restricted to 32 Mb, even small pictures like these might not work properly.

    There've been lots of posts, as Stephen noted, that advise you to re-size your pictures before you upload.  I use Irfanview for this. 

    In the cases where it's essential to retain the super-high resolution of the main picture, you should create the matching thumbnail outside PGV, and then upload the main picture and the thumbnail at the same time.  The Upload Media page lets you do this.  You can also use FTP, but that's not generally a good idea because you then have ownership issues of the server-resident files.

     
  • Kristian

    Kristian - 2011-04-22

    Hi!

    Thanks for replying!

    (1) As mentioned earlier, media/thumbs permission is set to 777.
    (2) Original image was a JPEG of ab. 500k.

    (3) On the side note. Sorry. I know answering the same question over and over gets old really quick. However, I did try to search but didn't come up with anything that sounded relevant. Obviously, given both of your replies, I should've tried harder.

    However, (a) I told PGV not to create thumbs. Why isn't the setting respected? I don't want users to have to worry about images being too large or not. If that's truly what's holding up uploads of an 500k image, I'm more than happy to create the thumbs manually. (b) Creating a thumb out of a 500k JPEG isn't that resource exhausting.

    On projects of my own, I'm using something like the following to create thumbs:

      81     $original_image = imagecreatefromjpeg($original_fil);
      82     $new_image = imagecreatetruecolor($new_width, $new_height);
      83     @imagecopyresampled($new_image, $original_image, 0, 0, 0, 0, $new_width, 
      84                         $new_height, $origina_width, $origina_height);
      85 
      86     // Write file
      87     @imagejpeg($new_image, $new_file, $quality);
      88 
      89     // Free memory
      90     @imagedestroy($original_image);
      91     @imagedestroy($new_image);
    

    The above happily creates thumbs out of +5MB JPEG's.

     
  • Kristian

    Kristian - 2011-04-22

    Tested with an image with the dimensions of 300x400 and size of 118KB. Same error.

    I took a closer look at phpinfo from witin PGV and noticed different values for local and master regarding memory limit. Local value is 32MB but master value significantly larger.

    Tried a quick grep memory_limit for all php files in PGV directory, but couldn't find the culprit. But on other projects on the same server, local value is equal to master. So somewhere, somwhow PGV sets it to 32MB.

     
  • Kristian

    Kristian - 2011-04-22

    Oh nevermind about the where PGV sets memory limit to 32MB. Found it. Should've told grep to be case-insensitive.

     
  • Kristian

    Kristian - 2011-04-22

    Surely it can't be about dimensions or filesize. Now tried with a tiny 300x400 23.2KB file; same result.

     
  • Kristian

    Kristian - 2011-04-22

    Upped memory limit to 512M; same result.

    What else might be wrong?

     
  • ggpauly

    ggpauly - 2011-04-22

    Kristian,

    Just a guess, but I think PGV is specific about files named ,jpg vs .jpeg.  Rename the file as a .jpg file & see if that helps.

    George

     
  • Kristian

    Kristian - 2011-04-22

    Thanks for chiming in!

    Unfortunately, that's not it.

    Originally, file was called 080911_09.jpg; changed to 080911-09.jpg (I have a vague memory I had problems with underscores and PGV in the past); changed to 080911.jpg -- but none of the three alternatives worked. Same result in all cases.

     
  • Gerry Kroll

    Gerry Kroll - 2011-04-22

    Can you e-mail me one of the pictures that doesn't work?  I'd like to try that on my system, just to be sure.

    Don't forget that there are actually TWO memory limits, and the lower of the two is what's used.  The first limit is set by your server's PHP configuration in the php.ini file.  The second is set in your PhpGedView configuration.

    if you run this simple 3-line PHP script, you easily see what the server's limits are.  Look for the text "memory_limit".

    ---begin script-----
    <?php
    phpinfo();
    ?>
    ---end script---

     
  • Gerry Kroll

    Gerry Kroll - 2011-04-22

    Sorry:  real e-mail address is  gkroll at keldine dot ca

     
  • Kristian

    Kristian - 2011-04-23

    Hi!

    Thanks for helping to figure it out!

    Email sent.

    About the memory limits. Yes. Good point. This is why I was babbling on about local and master values above. Both master (server) value and local (PGV config.php) memory limits are set to 512M.

     

Log in to post a comment.