osCmax v2.5 User Manual
Results 1 to 6 of 6

Product image upload error

This is a discussion on Product image upload error within the osCommerce 2.2 Discussion forums, part of the osCommerce 2.2 Forums category; When attempting to upload an image for a product and clicking update, the page would transition to a blank white ...

      
  1. #1
    Lurker
    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0


    Default Product image upload error

    When attempting to upload an image for a product and clicking update, the page would transition to a blank white page. After digging through the called and included files, I find the error occurs at this line (3827 in phpthumb.class.php):

    Code:
    return @ImageCreateFromString($RawImageData)
    If the image is too large, this function dies silently. I have been able to resolve this issue since (with a customized solution specific to our needs), and just wanted to make this information available to anyone having a similar problem.

  2. #2
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Default Re: Product image upload error

    phpthumb isn't included as standard in osCommerce but you've highlighted a section of code that could with being inserted into 'Max.
    [Though trying to upload huge image files to a website isn't too bright an idea. ]
    Last edited by ridexbuilder; 10-20-2010 at 03:12 PM.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  3. #3
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    2,678
    Rep Power
    49


    Default Re: Product image upload error

    Thanks for pointing this out! Could you post how big the maximum image size is?

    Or post how big the image was that you were uploading.

    Thanks for the info.

    Regards,
    pgmarshall
    _______________________________

  4. #4
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Arrow Re: Product image upload error

    Quote Originally Posted by pgmarshall View Post
    Thanks for pointing this out! Could you post how big the maximum image size is?

    Or post how big the image was that you were uploading.

    Thanks for the info.

    Regards,
    I found the limit in the documentation (it varies per environment). We could add code to prevent some eejit uploading a 4Mb, or so image, I guess. Some folks do need a lot of handholding.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  5. #5
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Default Re: Product image upload error

    A few snippets from the documentation:
    * max_source_pixels - This should be auto-detected, but
    if auto-detection fails and you get an invalid image
    from large source images, set this to about 20% of
    your available PHP memory limit.
    * imagemagick_path - If the source image is larger than
    max_source_pixels allows, but ImageMagick is available
    phpThumb() will use it to generate the thumbnail.
    So could place an semi-arbitrary limit on the source image.

    * phpThumb() works better and faster when ImageMagick is
    available. Most functions will work with only GD2, but
    speed is much faster with ImageMagick, and much larger
    images can be processed with ImageMagick than GD.
    Q: Some images generate thumbnails, but some fail (the original
    non-resized image is output instead).
    A: Your PHP installation does not have a high enough memory_limit
    and ImageMagick is not installed on the server. The PHP memory
    required is 5 times the number of pixels in the image.
    For example:
    640x480x5 = 1.5MB
    1600x1200x5 = 9.2MB
    You can adjust the PHP memory limit in php.ini (if you have
    permission on your server to do so), or (better yet) install
    ImageMagick on the server and that will bypass the memory limit
    issue. If you can't do either of the above, you can resize the
    images manually (with your favourite image editor) to a size
    that your memory_limit setting can handle, and/or you can
    re-save the images with an image editor that can embed an EXIF
    thumbnail (Photoshop for example) which phpThumb can use as an
    image source (lower image quality, but perhaps better than
    nothing).
    Last edited by ridexbuilder; 10-20-2010 at 02:53 PM.
    Hosting plans with installation, configuration, contributions, support and maintenance.

  6. #6
    osCMax Development Team
    ridexbuilder's Avatar
    Join Date
    Jul 2008
    Location
    Haggisland
    Posts
    3,014
    Rep Power
    36


    Default Re: Product image upload error

    Notwithstanding the above, maybe someone could add a message stack error message in instant_update.php
    Code snippet...
    PHP Code:
                    // generate & output thumbnail 
                    
    if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it! 
                        
    if ($phpThumb->RenderToFile($output_filename)) { 
                        
    // do something on success 
                        
    } else { 
                        
    // do something with debug/error messages 
                        
    echo 'Failed:<pre>'.implode("\n\n"$phpThumb->debugmessages).'</pre>'
                        } 
                    } else { 
                    
    // do something with debug/error messages 
                    
    echo 'Failed:<pre>'.$phpThumb->fatalerror."\n\n".implode("\n\n"$phpThumb->debugmessages).'</pre>'
                    } 
    Last edited by ridexbuilder; 10-20-2010 at 03:13 PM.
    Hosting plans with installation, configuration, contributions, support and maintenance.

Similar Threads

  1. Better image upload features
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 07-05-2010, 06:12 AM
  2. Better image upload features
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 11-25-2009, 10:00 AM
  3. Upload more than one image for product
    By Pcelica in forum osCmax v2 Installation issues
    Replies: 1
    Last Post: 10-31-2009, 12:20 PM
  4. customer upload image??
    By littleolemedesigns in forum General Topics & Chit Chat
    Replies: 0
    Last Post: 11-30-2007, 05:13 AM
  5. Help with multiple image upload
    By ozstar in forum osCmax v2 Installation issues
    Replies: 0
    Last Post: 11-29-2005, 12:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •