Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Imagemagick issues

    Hello,

    I've used Imagemagick on several sites - I've occasionally run into problems, but with a little tweaking, it's fixed.

    On the site I'm currently working on, I'm having no such luck. Images get uploaded without issue, but the thumbnail creation fails. I'm posting a portion of the relevant code here:

    -----BEGIN-----

    $LARGE_PATH="/home/lbier/public_html/lambda/large/";
    $THUMB_PATH="/home/lbier/public_html/lambda/thumbs/thumb_";

    copy($image_file[0],$LARGE_PATH.$image_file_name[0]);

    $quality="100";
    $res="150x100";
    @exec("which convert", $my_convert_path);

    $imagePath=$LARGE_PATH.$image_file_name[0];
    $resizedFile=$THUMB_PATH.$image_file_name[0];

    $make_magick = system("convert -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);

    -----END-----

    Any ideas on what I'm doing wrong?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,106
    Thanks
    11
    Thanked 101 Times in 99 Posts
    you are putting the path of `convert` into $my_convert_path (which may well be an array so check it ) but not actually using it

    system("convert -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);

    e.g use $my_convert_path (or $my_convert_path[0] ) instead.

    I have had occaision to use `mogrify` or one of the other IM commands before when 'convert' pointed to a totally different application but that would be unusual (on *NIX)
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've made the appropriate change, but no thumb is being created.

    I am now using:

    $make_magick = system($my_convert_path[0]." -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"",$retval);

    However, when I print out this statement, $my_convert_path[0] is empty. The output for:

    echo($my_convert_path[0]." -resize ".$res." -quality ".$quality." \"".$imagePath."\" \"".$resizedFile."\"");

    is:

    -resize 150x100 -quality 100 "/home/lbier/public_html/lambda/large/cliff.jpg" "/home/lbier/public_html/lambda/thumbs/thumb_cliff.jpg"

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,106
    Thanks
    11
    Thanked 101 Times in 99 Posts
    check the path first then...


    @exec("which convert", $my_convert_path);

    if( is_array( $my_convert_path ) ){
    print_r( $my_convert_path ) ;
    }else{
    echo $my_convert_path.'<br />';
    }
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #5
    New to the CF scene
    Join Date
    Jan 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, I came up with a slightly kludgey solution to this. My $my_convert_path is an empty array for some reason.

    I looked up some earlier code that I used on another server and dropped it in:

    @exec("/usr/local/bin/mogrify -scale ".$res." -quality ".$quality." \"".$resizedFile."\"");

    I now copy the large file to the thumb folder and use only one path in the command line (the one contained in $resizedFile).

    This isn't an ideal solution, but it'll do for the moment.

    Thanks for your help - much appreciated.


  •  

    Posting Permissions

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