VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
jaykappy
Posts: 41
Joined: 2013-07-12T07:58:15-07:00
Authentication code: 6789

VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by jaykappy »

Trying to get Imagemagick running on WIn7 2008R2 server with IIS 7.5

Have been trying for over a week now, getting the run around in every direction. Basically I am now simply trying to get the php_imagick.dll installed and recognized in IIS 7.5...easier said than done...I dont care if the versions are old as I am not doing anything else besides converting a PDF to JPG/PNG and re-sizing it.....

The only version of the .dll I can FIND for IIS7.5 is here: http://valokuva.org/builds/
I HAVE NO idea what version that corresponds with in regards to Imagemagick

I need a working pair IMageMagick, php_imagick.dll that will work with IIS7.5 on 2008R2 server

ANYONE know this?
jaykappy
Posts: 41
Joined: 2013-07-12T07:58:15-07:00
Authentication code: 6789

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by jaykappy »

If I really didnt need this I would have dropped ImageMagick a long time ago....HORRIBLE documentation

I got IIS 7.5 to recoginize the PHP_imagick.dll FINALLY......
Next step is to run exec() in PHP

1. Went to this site and found the newer dlls for PHP 5.3 and 5.4 - http://valokuva.org/?p=197
*Downloaded the imagick-php54-php53.tgz. and used winzip to open it...if you use Winzip you can see the Path field of the .tgz file...this tells you which one is for 5.3 and which is for 5.4
*I only tool the one dll for PHP 5.3 but there are the dlls for 5.4 as well (saved them of course)
2. I DID NOT install the latest version of ImageMagick - I installed this one - ImageMagick-6.8.0-1-Q8-windows-dll.exe
3. Go back ito IIS Manager and click on PHP for that website and then clikc on Check phpinfo() ...
* I can now see the 'imagick' in the php info

I have NOT done anything else for rights, permissions, installations etc....
JUST the above
what else am I missing

Starting to test I run this:

Code: Select all

$magick_dir = 'C:\ImageMagick' ; // install IM in short DOS 8.3 compatible path
$send_cmd=$magick_dir .'\convert uploads\17364.pdf uploads\thumbs\Test.png' ;			
        $array=array(); 
	echo "<pre>"; 
	exec("convert $send_cmd 2>&1", $array);  
	echo "<br>".print_r($array)."<br>"; 			
	echo "</pre>";   


$magickDir2 = 'C:\ImageMagick';
$send_cmd2=$magickDir2 .'\convert -list configure';	
	$array=array(); 
	echo "<pre>"; 
	exec("convert $send_cmd2 2>&1", $array);  
	echo "<br>".print_r($array)."<br>"; 			
	echo "</pre>";  

I get this:

Array
(
[0] => convert.exe: unable to open image `C:\inetpub\wwwroot\ImageUpload\ImageMagick\convert': No such file or directory @ error/blob.c/OpenBlob/2638.
[1] => convert.exe: no decode delegate for this image format `C:\inetpub\wwwroot\ImageUpload\ImageMagick\convert' @ error/constitute.c/ReadImage/550.
[2] => convert.exe: Postscript delegate failed `uploads\17364.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/679.
[3] => convert.exe: no images defined `uploads\thumbs\Test.png' @ error/convert.c/ConvertImageCommand/3044.
)

1

Array
(
[0] =>
[1] => Path: [built-in]
[2] =>
[3] => Name Value
[4] => -------------------------------------------------------------------------------
[5] => NAME ImageMagick
[6] =>
[7] => Path: configure.xml
[8] =>
[9] => Name Value
[10] => -------------------------------------------------------------------------------
[11] => CC vs10
[12] => COPYRIGHT Copyright (C) 1999-2012 ImageMagick Studio LLC
[13] => DELEGATES bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib
[14] => FEATURES OpenMP
[15] => HOST Windows
[16] => LIB_VERSION 0x680
[17] => LIB_VERSION_NUMBER 6,8,0,1
[18] => NAME ImageMagick
[19] => RELEASE_DATE 2012-11-01
[20] => VERSION 6.8.0
[21] => WEBSITE http://www.imagemagick.org
[22] => convert.exe: unable to open image `C:\inetpub\wwwroot\ImageUpload\ImageMagick\convert': No such file or directory @ error/blob.c/OpenBlob/2638.
[23] => convert.exe: no decode delegate for this image format `C:\inetpub\wwwroot\ImageUpload\ImageMagick\convert' @ error/constitute.c/ReadImage/550.
)

1
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by snibgo »

I think your commands are screwed up. They mention "convert" twice. For example, the first one expands to:

Code: Select all

convert C:\ImageMagick\convert uploads\17364.pdf uploads\thumbs\Test.png 2>&1
From the error message, we see that "convert" is running correctly and looks for an image as the first argument. But your first argument is "C:\ImageMagick\convert".

The first command should expand to:

Code: Select all

convert uploads\17364.pdf uploads\thumbs\Test.png 2>&1
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by fmw42 »

if this C:\ImageMagick\convert uploads\17364.pdf is a directory with a space in the name between convert and uploads and that is intentional, then enclose the whole thing in quotes. "C:\ImageMagick\convert uploads\17364.pdf"
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by snibgo »

Good theory, but the second command expands to:

Code: Select all

convert C:\ImageMagick\convert -list configure
and I assume it should expand to:

Code: Select all

convert -list configure
snibgo's IM pages: im.snibgo.com
jaykappy
Posts: 41
Joined: 2013-07-12T07:58:15-07:00
Authentication code: 6789

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by jaykappy »

Think I finally got it...was a whirl wind...would be so helpful if there was some documentation out there that gave you the steps and versions that work with each other...

1. Major issues were getting php_imgmagick.dll to be recognized in IIS7.5. THis required downloading the proper build for my PHP version 5.3. Can be found here (5.3 and 5.4)
* Went to this site and found the newer dlls for PHP 5.3 and 5.4 - http://valokuva.org/?p=197
* Downloaded the imagick-php54-php53.tgz. and used winzip to open it...if you use Winzip you can see the Path field of the .tgz file...this tells you which one is for 5.3 and which is for 5.4
* I only took the one dll for PHP 5.3 but there are the dlls for 5.4 as well (saved them of course)
* I placed the dll in the PHP folder...on my mchine here C:\Program Files (x86)\PHP\v5.3\ext
* modified the php.ini file to include: extension=php_imagick_nts.dll
2. I DID NOT install the latest version of ImageMagick - I installed this one - ImageMagick-6.8.0-1-Q8-windows-dll.exe
3. reboot
4. Go back ito IIS Manager and click on PHP for that website and then clikc on Check phpinfo() ...
* I can now see the 'imagick' in the php info
5. I installed GhostScript gs907w32 - http://www.ghostscript.com/download/gsdnld.html
6. I made sure I added the IUSR (machine name/IUSR) permissions ot the ImageMagick and gs folders

Tried for a few days to work directly with ImageMagick with no success...
Then decided to try GhostScript directly...which worked great...

I then tested with this:

Code: Select all

$magickDir3 = 'C:\gs\gs9.07\bin';
$send_cmd3=$magickDir3 .'\gswin32c -h';	
	$array=array(); 
	echo "<pre>"; 
	exec(" $send_cmd3 2>&1", $array);  
	echo "<br>".print_r($array)."<br>"; 			
	echo "</pre>"; 	
My final code looks like this, will remove the array and just run the exec

Code: Select all

$magickDir4 = 'C:\gs\gs9.07\bin';
$inputimage = 'uploads/'.$album_id.'/'.$image_file;
$outputimage = 'uploads/thumbs/'.$image_id.'.png'; 
$send_cmd4=$magickDir4 .'\gswin32c -dNOPAUSE -sDEVICE=png16m -dFirstPage=1 -dLastPage=1 -sOutputFile='.$outputimage.' -r100x100 -q '.$inputimage.' -c quit';	
	$array=array(); 			
	echo "<pre>"; 			
	exec(" $send_cmd4 2>&1", $array);  			
	echo "<br>".print_r($array)."<br>"; 						
	echo "</pre>";
 

I truly appreciate all your held and comments...they were greatly appreciated...
I will glance back at these posts for a few days if anyone has questions...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by snibgo »

So you've given up with ImageMagick? Fair enough. Just out of curiosity, did you try correcting the commands as I suggested above?
snibgo's IM pages: im.snibgo.com
jaykappy
Posts: 41
Joined: 2013-07-12T07:58:15-07:00
Authentication code: 6789

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by jaykappy »

snibgo wrote:So you've given up with ImageMagick? Fair enough. Just out of curiosity, did you try correcting the commands as I suggested above?
going to give those a shot....when I have a bit of free time...would like to figure both ways out..
Seems directly calling GhostScript seems to be a bit faster? Or I could be wrong.
Thanks
jaykappy
Posts: 41
Joined: 2013-07-12T07:58:15-07:00
Authentication code: 6789

Re: VERSION ISSUES IIS7.5 (imagemagick, php_imagick.dll)

Post by jaykappy »

gave it a go....

I ran two examples same code..one converting jpg the other converting PDF (i need the pdf conversion, workign with GS right now.)
Basically same code, files exists in specified locations
Wont convert PDF for some reason...JPG conversion works fine
Unless you have any further thoughts i am going to stick with GS...I dont know what else to do...would like to fix

CODE:

Code: Select all

	//// ImageMagick working JPG to PNG
	$magick_dir = 'C:\ImageMagick' ; // install IM in short DOS 8.3 compatible path
	$send_cmd=$magick_dir .'\convert uploads\16751.jpg uploads\Test_jpg.png' ;
				echo $send_cmd;
				$array=array(); 
				echo "<pre>"; 
				exec("$send_cmd 2>&1", $array);  
				echo "<br>".print_r($array)."<br>"; 			
				echo "</pre>"; 
	//// ImageMagick NOT WORKING PDF to PNG			
	$magick_dir1 = 'C:\ImageMagick' ; // install IM in short DOS 8.3 compatible path
	$send_cmd1=$magick_dir1 .'\convert uploads\16751.pdf uploads\Test_pdf.png' ;
				echo $send_cmd1;
				$array=array(); 
				echo "<pre>"; 
				exec("$send_cmd1 2>&1", $array);  
				echo "<br>".print_r($array)."<br>"; 			
				echo "</pre>";
RESULTS:

C:\ImageMagick\convert uploads\16751.jpg uploads\Test_jpg.png
Array
(
)

1
C:\ImageMagick\convert uploads\16751.pdf uploads\Test_pdf.png
Array
(
[0] => convert.exe: Postscript delegate failed `uploads\16751.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/679.
[1] => convert.exe: no images defined `uploads\Test_pdf.png' @ error/convert.c/ConvertImageCommand/3044.
)

1
WhiteOwl
Posts: 1
Joined: 2014-02-03T06:29:40-07:00
Authentication code: 6789

SOLVED: Windows 2008 R2 x64, PHP 5.5.x, IIS, imagemagick !!

Post by WhiteOwl »

So after 4 hours I got it working:

You got Windows (x32 o x64) and IIS. You want PHP 5.5 and Imagemagick.

!! : Everything (PHP, Imagemagick installation, php_imagick.dll) needs to be x86 (32bit) for now (x64 builds are still experimental).

Tested and working:
Windows: 2008R2 x64 SP1
Visual C++ 2012 redist x86 and x64: http://www.microsoft.com/en-us/download ... x?id=30679
PHP 5.5:
5.5.8 VC11 x86 Non Thread Safe (2014-Jan-09 18:16:08) ... all php5.5.x x86 nts should work ...
http://windows.php.net/downloads/releas ... 11-x86.zip
Imagemagick:
ImageMagick-6.8.4-0 Q16 x86 dll (you can try newer 6.8.4.x versions, but allways -x86-dll) ... install to c:\imagemagick and during install check "add to system path" ...
http://ftp.sunet.se/pub/multimedia/grap ... 86-dll.exe
php_imagick.dll :
get it from this site: http://www.peewit.fr/imagick/ :
version: Imagick for PHP 5.5.x, MSVC11 (Visual C++ 2012 Express), x86, Non Thread Safe, Build Date: Jul 9th, 2013 22:26:55 (CET), Download: php_imagick.dll (244 Kio)
http://www.peewit.fr/imagick/php55/vc11 ... magick.dll
copy to php\ext dir ane add this extension to php.ini ... restart IIs (or windows) and ... done :)
Post Reply