Getting started with ImageMagick

apps

#1

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.


#2

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

-Scott


#3

of course… lack of sleep doesn’t help either :wink:

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.

also, more importantly, I need tiff support, and that’s showing up as no:


Checking for TIFF support

checking tiff.h usability… no
checking tiff.h presence… no
checking for tiff.h… no
checking tiffio.h usability… no
checking tiffio.h presence… no
checking for tiffio.h… no
checking for TIFFOpen in -ltiff… no
checking for TIFFClientOpen in -ltiff… no
checking for TIFFIsByteSwapped in -ltiff… no
checking for TIFFReadRGBATile in -ltiff… no
checking for TIFFReadRGBAStrip in -ltiff… no
checking if TIFF package is complete… no

Is that something I have to install separately as well?

thanks!


#4

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:

Checking for TIFF support

checking tiff.h usability… yes
checking tiff.h presence… yes
checking for tiff.h… yes
checking tiffio.h usability… yes
checking tiffio.h presence… yes
checking for tiffio.h… yes
checking for TIFFOpen in -ltiff… no
checking for TIFFClientOpen in -ltiff… no
checking for TIFFIsByteSwapped in -ltiff… no
checking for TIFFReadRGBATile in -ltiff… no
checking for TIFFReadRGBAStrip in -ltiff… no
checking if TIFF package is complete… no – some components failed test

and in the config log, I can see it’s trying to find -ltiff in usr/bin/ld, not in my /home/alleycat_ftp/local folders…

configure:39000: checking for TIFFOpen in -ltiff
configure:39035: gcc -o conftest -g -O2 -Wall -W -pthread -I/usr/include/freetype2 -I/home/alleycat_ftp/local/include -L/home/alleycat_ftp/local -L/usr/X11R6/lib -lfreetype -lz conftest.c -ltiff -ljpeg -lpng -lfreetype -lXext -lX11 -lz -lm -ldl -lpthread >&5
/usr/bin/ld: cannot find -ltiff

so I’m stuck again… what am I missing?


#5

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


#6

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

Thanks!


#7

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:

[code]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.”
”;

//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:
”;
echo “Convert Command:
" .$convert.”
";
echo "Output:
";
var_dump($execOutput);
echo ‘
’;
echo "Returned: ".$execReturn.’
’;
};
print “”;
}
}
[/code]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.


#8

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