Big pictures can't upload

Hi

I'm sure there is a simple explanation, but when I try to upload a picture at 3072x2048px (4.6MB) it allways fail.

I have tried setting up the memory_limit in php.ini to 128MB

I have tried setting max upload size in tidypics to 30720.

I have tried both GD and imagick.

When uploading smaller photos ImageMagick produces blank thumbnail and pictures, as if t does nothing at all - only when I choose to download the picture I can see it.

ImageMagick details:

  • Version: ImageMagick 6.2.4 02/10/07 Q16 http://www.imagemagick.org
  • Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC
  • path to /usr/bin/convert

GD works fine on smaller pictures.

I'm using the svn trunk version of tidypics on a freshly installed Elgg 1.5.

Any ideas?

 

Regards

slyhne

 

  • We'll look into this. The GD code was restructured this weekend though we haven't updated the error messages yet. It's best to add bug reports on svn versions to ore tracker: http://code.google.com/p/tidypics/issues/list

    I believe the thumbnail creation for ImageMagick was recently changed also. I haven't tested it. What were the size of the images that were failing for ImageMagick?

  • Hi Cash

    I'll try updating from svn again to get the new GD code.

    All sizes of images failed when using ImageMagick, from 100x100px up to 3072x2048px.

    I will post my problems with the updated version (if there are any) on the tracker instead of here.

    Thanks

    slyhne

  • I'm haveing the same issue with big images!!!

    :(

  • @slyhne - not surprised on the ImageMagick code failures - it is making system calls. Most servers won't allow that. We're also going to work up a PHP ImageMagick version.

  • @Michael Howe - the new version will have much better error handling but GD is very inefficient with memory so there will always be a limit to image size. That is why we are working with ImageMagick also.

  • @Tidypics Team:

    For information:

    TidyPics Server Analysis
    PHP version                     5.2.9-0.dotdeb.0        
    GD                              Enabled
    ImageMagick                     Enabled        
    Memory Available to PHP         128MB
    Memory Used to Load This Page   10.04 MB
    Max File Upload Size            0.00 KB
    Max Post Size                   0.01 KB
    Max Input Time                  -1 s
    Max Execution Time              30 s

    In tidypics settings I have the max. file size set to 20480.

    That should be enough to load big pictures, so there must be something in the code that limits the size of pictures to upload.

    Regards

    slyhne

  • @Tidypics Team

    Tried replacing your shell command (convert) with some ImageMagick API calls in lib/resize.php

    Now I can use ImageMagick to resize pictures, even though my thumbnails doesn't preserver aspect ratio. Mayby someone with more coding skills can fix that?

    Problem with large files is still present. Images over 2.5MB fails under upload with an Elgg message about "Too many bytes".

    imagick code in resize.php:

    $image = new Imagick( $input_name );
    $image->resizeImage($newwidth, $newheight, imagick::FILTER_LANCZOS, 1);
    $image->writeImage($output_name);
    return $output_name;
    // $im_path = get_plugin_setting('convert_command', 'tidypics'); // if(!$im_path) { // $im_path = "/usr/bin/"; // } // if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/"; // $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
    // system($command); // return $output_name;

    code end:

    Regards

    slyhne

  • Thanks for the php code. We hadn't gotten around to that yet.

    I don't understand why you are getting these values:

    Max File Upload Size            0.00 KB
    Max Post Size                   0.01 KB

    The default Elgg .htaccess has these values:

        # max post size to 8Mb
        php_value post_max_size 8388608
        # upload size limit to 5Mb 
        php_value upload_max_filesize 5242880

    These values determine how much data can be uploaded in a single upload and how large each file can be.

    It's possible that our code is not correctly parsing upload size and post size. I'll check into that.

  • @Tidypics Team

    I found the error :-)

    Your convert command is using a ImageMagick version 6.3.8-3 resize flag '^'

    My web hotel only offers version 6.2.4 :-(

    To make it work I added two variables and changed the convert command.

    $x2width = $newwidth * 2;
    $x2height = $newheight * 2;
    $command = $im_path . "convert \"$input_name\" -size \"".$x2width."x\" -size \"x".$x2height."<\" -resize \"50%\" -gravity center -crop \"".$newwidth."x".$newheight."+0+0\" +repage \"$output_name\"";

    The above convert makes good quality thumbnails and is backward compatible. It does however have some problems with large images being scaled to much but I'll try to figure out how to change that.

    Regards

    slyhne

  • @TidyPics Team

    Just a little add-on for your "Tidypics Server Analysis:

    if (!function_exists('is_executable')) {
      echo "No PHP is_executable() function!";
    } else if (!is_executable('/usr/bin/convert')) {
      echo "Couldn't execute /usr/bin/convert!;
    } else {
      echo "No ImageMagick installation problems detected.";
    }
    

    The above code checks to see if convert can be executed