Getting started with ImageMagick

Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-08 14:04:00

I need to use ImageMagick on one of my sites, and I could use some help getting going.

First off, the installed version on my server is only 6.2.4, and I would like to install the latest (6.3.9) as I would like to use some of the newer features and supported file formats. I found the wiki article ( http://wiki.dreamhost.com/KB_/_Web_Programming_/_Do_you_support....?_/_ImageMagick#Parent_Article ) with instructions for compiling my own version, but they don't seem to work, and I'm no shell expert.
The first line:
~src$ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz

returns the error: bash: ~src$ command not found. So already I'm at a loss.

I would sure appreciate some help here. Thanks in advance.

Re: Getting started with ImageMagick

Posted by: sdayman
Posted on: 2008-03-08 14:59:00

Start with wget and onward. Not the ~src$ part, which is just a UNIX prompt.

-Scott

Re: Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-09 11:53:00

of course... lack of sleep doesn't help either ;)

If I need ghostscript support, do I need to install that first? I included the "--with-gslib" line, but all the ghostscript options show "no" in the config report.

thanks!

Edited by madsamurai on 03/09/08 11:59 AM (server time).

Re: Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-09 16:36:00

wow, this is cryptic stuff...

OK, so I installed the tiff lib in $HOME/local successfully (I think), but I'm having trouble getting the ImageMagick configure script to find it and pass its tests.

I've managed to get part-way using this:
./configure CPPFLAGS=-I$HOME/local/include LDFLAGS=-L$HOME/local --prefix=$HOME/local --with-gs-font-dir=/usr/share/fonts/type1/gsfonts --with-perl-options=PREFIX=$HOME/perl

which gives me these results:

Re: Getting started with ImageMagick

Posted by: Alpicola
Posted on: 2008-03-09 18:19:00

Do you perhaps mean -L$HOME/local/lib instead of -L$HOME/local ?

Re: Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-09 18:39:00

heh... I thought I had tried that, but guess not. That did the trick.

Thanks!

Re: Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-13 18:20:00

ok, got the install completed, but I'm having trouble now getting it to work.
Here's the exerpt from my script that handles a new file upload:

if( $files['bitmapfile']['name'] != "" ) 
{
$bitmapFileTemp = $files['bitmapfile']['tmp_name'];
$bitmapFileName = $files['bitmapfile']['name'];

$bitmapArtExt = JFile::getExt( $bitmapFileName );
$bitmapArtName = $primaryfolder.DS.$newArtName.'.bmap.orig.';

if (!JFile::upload( $bitmapFileTemp , $bitmapArtName.$bitmapArtExt ))
{
$msg = "Bitmap File Upload failed! path: ".$bitmapArtName.$bitmapArtExt;
$this->setRedirect( 'index.php?option=com_clientcenter&view=artmanagement', $msg );
$this->redirect();
} else {
echo "Bitmap File Upload successful. path: ".$bitmapArtName.$bitmapArtExt."<br />";

//create and save thumbnail and screensize images
$location = '$HOME/local/bin/convert';
$command = '-thumbnail 150';
$name = $primaryfolder.DS.$newArtName.'.';
$extfrm = $bitmapArtExt;
$extto = 'png';
$output = "{$name}thumb.{$extto}";
$convert = $location . ' ' .$command . ' ' . $bitmapArtName . $extfrm . ' ' . $name .'thumb.'. $extto;

if(!exec ($convert,$execOutput,$execReturn))
{
echo "can't execute convert command:<br />";
echo "Convert Command: <br />" .$convert."<br />";
echo "Output: <br />";
var_dump($execOutput);
echo '<br />';
echo "Returned: ".$execReturn.'<br />';
};
print "<img src=" . $output . ">";
}
}

this results in the following output:

Bitmap File Upload successful. path: ../clientArt/Client66/live_thumb_test/primary/live_thumb_test.bmap.orig.jpg
can't execute convert command:
Convert Command:
$HOME/local/bin/convert -thumbnail 150 ../clientArt/Client66/live_thumb_test/primary/live_thumb_test.bmap.orig.jpg ../clientArt/Client66/live_thumb_test/primary/live_thumb_test.thumb.png
Output:
array(0) { }
Returned: 127

the paths are all correct, and the file upload itself is working, but no thumbnail... and the only error message I can seem to get is the returned '127'

In my site log, I see these statements:

[Thu Mar 13 17:42:10 2008] [error] [client (myip)] sh: line 1: /local/bin/convert: No such file or directory, referer: http://alleycat.chadroyer.com/index.php?option=com_clientcenter&view=artupload&Itemid=55
[Thu Mar 13 17:42:11 2008] [error] [client (myip)] File does not exist: /home/alleycat_ftp/alleycatworldwide.com/public/clientArt, referer: http://alleycat.chadroyer.com/index.php?option=com_clientcenter&view=artupload&Itemid=55
[Thu Mar 13 17:42:11 2008] [error] [client (myip) File does not exist: /home/alleycat_ftp/alleycatworldwide.com/public/missing.html, referer: http://alleycat.chadroyer.com/index.php?option=com_clientcenter&view=artupload&Itemid=55

So, it doesn't seem to be finding $HOME/local/bin/convert, tho I can see that is where it is.
Also in the second line, it's pointing to the wrong folder. My clientArt folder is below my public folder, not in it, to avoid outside access. It should be pointing to /home/alleycat_ftp/alleycatworldwide.com/clientArt (If I have to move the clientArt folder into the public site area for this to work, I guess I'll do that, but I'd rather not)

Please help... I'm wasting a lot of days here getting this working.

Re: Getting started with ImageMagick

Posted by: madsamurai
Posted on: 2008-03-14 14:12:00

ok... so it won't work calling $HOME/local/bin/convert. I had to set the command to /users/.mamo/myusername/local/bin/convert, and that fixed it. Also all of the file paths need to have the complete path as well, not the path relative to the site/script. And the images have to be within the public area of the site or they won't display (tho they will convert and save), which sucks, but I don't know what can be done about it.

Now if I could just get my local install working... *sigh*

Tags: imagemagicktar gzweb programmingthanks in advanceshell