Apostrophe in filename giving inconsistent results
Posted: 2009-04-27T06:03:44-07:00
Hi, I'm new
I came to start using ImageMagick because my host seems to kill php scripts that use too much memory, and a gd imagecreatefromjpeg with an 8 megapixel file was well above the limits they'd set.
I've had fantastic results with ImageMagick so far but am having some rather odd behaviour in the script I'm writing and figured i'd share..
Basically this part of code is meant to do a very similar thing as the polaroid function. (I actually was nearly finished writing it before I even realised the polaroid function existed... then I found that the version of imagick my host has installed doesn't have the function available anyway.)
Here's the pertinent code:
$src has had escapeshellarg() run on it to ensure it should be safe to pass to ImageMagick.
The result:
So far so good.
The problem occurs when the filename has an apostrophe (') in it (eg )
Yet oddly the normal resize function works fine, with the same arguments:
http://antarctica.go-forth.co.uk/p2/res ... ls0016.jpg
code for that:
So.. my thoughts are that It shouldn't really be an issue with the $src variable (because otherwise the normal resize function would fail too)... but I have no real idea why a filename with an apostrophe would be fine with one convert command and not with the other.
Thoughts?
I came to start using ImageMagick because my host seems to kill php scripts that use too much memory, and a gd imagecreatefromjpeg with an 8 megapixel file was well above the limits they'd set.
I've had fantastic results with ImageMagick so far but am having some rather odd behaviour in the script I'm writing and figured i'd share..
Basically this part of code is meant to do a very similar thing as the polaroid function. (I actually was nearly finished writing it before I even realised the polaroid function existed... then I found that the version of imagick my host has installed doesn't have the function available anyway.)
Here's the pertinent code:
Code: Select all
$command = "convert " . $src . " -thumbnail " . $thumbmaxwidth . "x" . $thumbmaxheight . " -mattecolor \"#" . $imgbordercol . "\" -background \"#" . $imgbordercol . "\" -gravity South -splice 0x19 -annotate 0x0 '" . $fn . "' -frame 3x3+2+0 -matte -background none -rotate 90 -wave " . $amplitude . "x" . $wavelength . " -rotate -90 -rotate " . $rotateamt . " \( +clone -background gray75 -shadow 60x2+3+3 \) +swap -background none -mosaic -quality " . $thumbqual . " " . $dest;
exec($command);
The result:
So far so good.
The problem occurs when the filename has an apostrophe (') in it (eg )
Yet oddly the normal resize function works fine, with the same arguments:
http://antarctica.go-forth.co.uk/p2/res ... ls0016.jpg
code for that:
Code: Select all
$command = "convert " . $src . " -resize " . $maxwidth . "x" . $maxheight . "\> -fill white -undercolor '#00000080' -gravity South -annotate +0+5 ' " . $wmarktext . " ' -quality " . $resizequal . " " . $dest;
exec($command);
Thoughts?