ImageMagick path problem?

Having trouble installing serendipity?
Post Reply
Guest

ImageMagick path problem?

Post by Guest »

Hello all.

I installed Serenedipity in July of 2003 to replace my static blog I had for years before. When I sucessfully installed Serendipity, I did not work with the image uploads.

Anyhow, here it is over a year later, and I would like to make use of the file uploads, but the problem is this: My hosting company does not have GD2 installed, so I'm forced to use imagemagick.

So, I've uploaded and extracted imagemagick outside of the public_html directory (../imagemagick)

I have run CHMOD 777 on imagemagick/ and also CHMOD 777 on /public_html/uploads. It shouldn't be a permissions problem.

I upload a large image, and serenedipity won't build the thumbnail, it also won't resize the orignal image.

My hosting company says they have imagemagick installed at /usr/addr/ImageMagick/bin, I tried to use that path for ImageMagick, as well with no success.

Any ideas?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: ImageMagick path problem?

Post by garvinhicking »

Is your PHP maybe running in SafeMode or has external execution disabled?

Which Serendipity version are you using? Then I can tell you a few lines to put debugging code into...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
pixeldown
Regular
Posts: 7
Joined: Mon Aug 16, 2004 4:22 pm
Location: Canada
Contact:

Post by pixeldown »

Hi Garvin.

Actually, you had helped me out with a questions on upgrading to version v.0.7.1 recently. Which worked well, so that is the version I'm running now.

I don't think PHP is running in safe mode, at least I hope it's not. I'm paying a hosting company to worry about that kind of thing. Although I'm terribly unhappy with their service and will be leaving as soon as I get setup with another alternative.

Related info: I'm running a version of Gallery that is using netpbm from ../netpbm, it appears to fine. http://www.pixeldown.net/gallery/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Okay, since you're running version 0.7.1 of Serendipity, please do this:

1. Open your serendipity_functions_images.inc.php file
2. Locate the function serendipity_makeThumbnail()
3. Insert this code:

Code: Select all

    if (isset($fdim['noimage'])) {
        $r = array(0, 0);
    } else {
        echo 'imagemagick is: ' . print_r($serendipity['magick'], true) . '<br />';
        if ($serendipity['magick'] !== true) {
            echo 'Executing GDLib resizing.<br />';
            $r = serendipity_resize_image_gd($infile, $outfile, $size);
        } else {
                /*if ($serendipity["dim"] == "height") $newSize = "*x".$serendipity["thumbSize"];
                else $newSize = $serendipity["thumbSize"]."x*"; */
            $newSize = $size . 'x' . $size;
            $r = array($size, $size);
            $cmd     = $serendipity['convert'] . " -antialias -scale $newSize $infile $outfile  2>&1";
            echo 'Executing imageMagick: ' . $cmd . '<br />';
            $res     = `$cmd`;
            echo 'Got result: ' . print_r($res, true) . '<br />';
        }
        echo 'Image Routine done.<br />';
    }
[code]

instead of the previous if/else block there (starting from "if (isset($fdim['noimage'])) {").

Then please try again to upload an image, you should now get additional information.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
pixeldown
Regular
Posts: 7
Joined: Mon Aug 16, 2004 4:22 pm
Location: Canada
Contact:

Post by pixeldown »

The closest i can come to that if/else statement is

Code: Select all

if ( !isset($fdim['mime']) ) {
This is where I found it:

Code: Select all

/**
* Generate a thumbnail
**/
function serendipity_makeThumbnail($file, $size=false) {
    global $serendipity;

    if ($size === false) {
        $size = $serendipity['thumbSize'];
    }

    // Calculate name of thumbnail
    $t = serendipity_parseFileName($file);
    $f = $t[0];
    $suf = $t[1];

    $infile  = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $file;
    $outfile = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . $f . '.' . $serendipity['thumbSuffix'] . '.' . $suf;
    $fdim = getimagesize($infile);

    if ( !isset($fdim['mime']) ) {
       $fdim['mime'] = serendipity_guessMime($infile);
    }

    if ($serendipity['magick'] !== true) {
        $r = serendipity_resize_image_gd($infile, $outfile, $size);
    } else {
            /*if ($serendipity["dim"] == "height") $newSize = "*x".$serendipity["thumbSize"];
            else $newSize = $serendipity["thumbSize"]."x*"; */
        $newSize = $size . 'x' . $size;
        $r = array($size, $size);
        $cmd     = $serendipity['convert'] . " -antialias -scale $newSize $infile $outfile  2>&1";
        $res     = `$cmd`;
    }


Perhaps I am looking in the wrong place?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

If you really have that file with those contents, you are not using Serendipity 0.7.1!

The file in the release tarball looks different than yours. Look at the top of serendipity_functions_images.inc.php - it should read:

Code: Select all

serendipity_functions_images.inc.php,v 1.38 2004/10/29 10:11:25 garvinhicking Exp $
If that's not the case, you did something wrong when upgrading/installing Serendipity, or you have a different version...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

:oops:

My bad! The local image of my web site hasn't been updated since I upgraded. I'm sorry for the mistake. I'll have a chance to fix that this evening and then add your code snippet.

--
Chris.
Post Reply