Imagick PHP 5.4 extension does not work with relative paths. (windows)
NickName:filip.karas Ask DateTime:2012-03-31T17:36:24

Imagick PHP 5.4 extension does not work with relative paths. (windows)

I'm trying to install imagick PHP extension on windows. It was working on PHP 5.2, PHP 5.3 but I have problems with PHP 5.4.

Imagick version: ImageMagick-6.7.6-3-Q16-windows-dll. Module is working. I can see imagick in phpinfo().

The problem is, that imagick does not recognize relative path to files. For example, if I have simple index.php and a.jpg in the same folder, I can't use $im = new imagick('a.jpg'); because I get exception:

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open image `a.jpg': No such file or directory @ error/blob.c/OpenBlob/2614' in D:\Web\i\index.php:3 Stack trace: #0 D:\Web\i\index.php(3): Imagick->__construct('a.jpg') #1 {main} thrown in D:\Web\i\index.php on line 3

But when I use absolute path $im = new imagick('D:\web\i\a.jpg'); it is working.

I found out, that Imagick is using Apache core dir as reference. I saved the image without path:

$im->writeImage( 'this-is-what-im-looking-for.jpg' );

And I found it in C:\Program Files (x86)\Apache24\this-is-what-im-looking-for.jpg

The problem is, that all my old scripts are written with relative paths and I would like to countinue using them.

I don't know, if the problem is in imagick itself, or somewhere in PHP 5.4.

Thank You in advance

Copyright Notice:Content Author:「filip.karas」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/9954764/imagick-php-5-4-extension-does-not-work-with-relative-paths-windows

More about “Imagick PHP 5.4 extension does not work with relative paths. (windows)” related questions

Imagick PHP 5.4 extension does not work with relative paths. (windows)

I'm trying to install imagick PHP extension on windows. It was working on PHP 5.2, PHP 5.3 but I have problems with PHP 5.4. Imagick version: ImageMagick-6.7.6-3-Q16-windows-dll. Module is working...

Show Detail

Imagick PHP 5.5 extension does not work with paths. (windows)

I'm trying to install imagick PHP extension on windows. I have problems with PHP 5.5. Imagick version: ImageMagick-6.9.3-8-Q16-x64-dll. Module is working. I can see imagick in phpinfo(). The prob...

Show Detail

Imagick extension with relative paths

I have done much Image processing development in localhost using Imagick extension. Now while going live, my requirement is to load images from remote url in imagick. As per my surfing, Imagick do...

Show Detail

PHP - imagick extension

I am trying to install php imagick extension.For that I installed Image Magic on windows 7 and it works fine.when I am trying to enable Image Magick extension it doesn't work System Specifications...

Show Detail

How to install Imagick/imagemagick PHP extension on windows 7

How to install image magic in Windows 7. I followed these instruction To install IMagick on Windows XP (php 5.2.x) download and install ImageMagick-6.5.8-7 Q16-windows-dll.exe http://www.imagemag...

Show Detail

where we find imagick for windows and imagick extension php_imagick.dll that compatible to wamp 2.5?

I already tried install imagick in windows, but always failed, php startup unable to load dinamic library, 'c/wamp/.../php_imagick.dll'-%1 is not valid win 32 where we find imagick for window...

Show Detail

How to install Imagick extension on Windows PHP 7.0

I need to install Imagic extension on my Apache - PHP 7.0 server. I followed very nice guide located here: https://herbmiller.me/2016/06/16/installing-imagick-php-7/. Based on "php -i" out: PHP Ve...

Show Detail

Installing imagick library extension on xampp Windows?

I have to convert pdf to image format (jpg or png) for a thesis project and was planning to install the imagick library on xampp which proved to be tricky. By the way, the php version that I curren...

Show Detail

Install Imagick on Windows/Wamp

I encounter problems to install Imagick on Windows using Wamp. I tried to install differents version ,I've followed differents tutorials like : How to install Imagick/imagemagick on windows 7 Or...

Show Detail

Windows PHP Imagick not working

I am trying for 1 days and this php imagick don't work in windows. It shows ImageMagick number of supported formats: 0 ImageMagick supported formats no value First I went to official php web...

Show Detail