473,670 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Php and ImageMagick in Windows?

I am trying to use ImageMagick from a Php script running under Windows XP.

I have installed the latest version of ImageMagick - 6.2.1-7 and even
tried backing up to version 5.5.7 (based on a recommendation I found
during a Google search), but I can not get ImageMagick to work in Php
(using exec or system).

ImageMagick works from a Windows Command prompt -

e.g., convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png

but that same command using the system function -

i.e., system("convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png", $retval);

always fails with a retval of either 4 or 1. (The retval was 4 until I
rebooted and tried again, and now it is always 1).

I am able to execute other windows commands (e.g. dir) from within the
system and exec functions in Php.

Can anyone help me figure out how to get ImageMagick to run from a Php
script - in Windows? I have tired using the full path to the convert
command, but that does not change anything (the ImageMagick installation
adds itself to the PATH environment variable anyway).

TIA

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*************** **************
Jul 17 '05 #1
3 7078
Chuck Anderson wrote:
I am trying to use ImageMagick from a Php script running under Windows
XP.

I have installed the latest version of ImageMagick - 6.2.1-7 and even
tried backing up to version 5.5.7 (based on a recommendation I found
during a Google search), but I can not get ImageMagick to work in Php
(using exec or system).

ImageMagick works from a Windows Command prompt -

e.g., convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png

but that same command using the system function -

i.e., system("convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png", $retval);

always fails with a retval of either 4 or 1. (The retval was 4 until
I rebooted and tried again, and now it is always 1).

I am able to execute other windows commands (e.g. dir) from within the
system and exec functions in Php.

Can anyone help me figure out how to get ImageMagick to run from a Php
script - in Windows? I have tired using the full path to the convert
command, but that does not change anything (the ImageMagick
installation adds itself to the PATH environment variable anyway).


You probably need to escape the \ characters, or switch them around so
they're / instead.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
Jul 17 '05 #2
"Chuck Anderson" <we************ @seemy.sig> wrote in message
news:jL******** ************@co mcast.com...
I am trying to use ImageMagick from a Php script running under Windows XP.

I have installed the latest version of ImageMagick - 6.2.1-7 and even
tried backing up to version 5.5.7 (based on a recommendation I found
during a Google search), but I can not get ImageMagick to work in Php
(using exec or system).

ImageMagick works from a Windows Command prompt -

e.g., convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png

but that same command using the system function -

i.e., system("convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htdoc s\testing\temp_ .png", $retval);


You know you need to escape backslashes in strings, right?
Jul 17 '05 #3
Chung Leong wrote:
"Chuck Anderson" <we************ @seemy.sig> wrote in message
news:jL******* *************@c omcast.com...

I am trying to use ImageMagick from a Php script running under Windows XP.

I have installed the latest version of ImageMagick - 6.2.1-7 and even
tried backing up to version 5.5.7 (based on a recommendation I found
during a Google search), but I can not get ImageMagick to work in Php
(using exec or system).

ImageMagick works from a Windows Command prompt -

e.g., convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htd ocs\testing\tem p_.png

but that same command using the system function -

i.e., system("convert C:\apache\htdoc s\testing\temp_ .jpg
C:\apache\htd ocs\testing\tem p_.png", $retval);


You know you need to escape backslashes in strings, right?

Thanks for the replies. I must admit that I was being a little ignorant
on that count ... but, I had already tried reversing the slashes:

system("convert .exe C:/apache/htdocs/testing/temp_.jpg
C:/apache/htdocs/testing/temp_.png", $retval);

and after these two replies, I tried escaping the backslashes:

system("convert .exe C:\\apache\\htd ocs\\testing\\t emp_.jpg
C:\\apache\\htd ocs\\testing\\t emp_.png", $retval);

But both methods still gave me a retval of 1.

However, I then tried using a relative path - or no path (leave off the c:):

system("convert .exe temp_.jpg temp_.png", $retval);

or (placing the images in a sub folder)

system("convert .exe photos/temp_.jpg photos/temp_.png", $retval);

and then it it works.

It seems that I can not use an absolute path
(c:\apache\htdo cs\testing\temp _.png). I'm not sure why the c: part is a
problem, but using relative paths is all I really need to do. I was only
using full paths to be sure I was pointing to the right location of the
files while testing.

Thanks for the help.

--
*************** **************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Integrity is obvious.
The lack of it is common.
*************** **************
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7411
by: Randell D. | last post by:
Folks, I've not used ImageMagick before - I've worked with the gd functions that are pre-compiled in PHP and found some of the limits problematic yet heard better reviews on ImageMagick. I've got PHP 4.3.3 - When I do a phpinfo(); it tells me it was compiled with --with-imagemagick There is no other mention of it anywhere (unlike GD which is listed further down in its own box). Can someone give me a quick one or two liner script that...
0
1936
by: Andrew Crowe | last post by:
Hi guys, I'm having some trouble using the exec() command on a Windows 2000 / IIS server (PHP5rc2 running as ISAPI). I can execute programs fine, but they are unable to interact with any files on the server (either reading or writing). Eg. if I call exec("type R:/webroot/website/file.php") from PHP I get nothing (it works in a console window). Using the "copy" command outputs
3
5621
by: Joe | last post by:
Hey I have tried to install ImageMagick on my server, but my apache stalls when i try to start it with the following line added to my php.ini file: extension=php_imagick.dll I can't even kill the apache procees when I try to run it with this option added, so I have to restart the entire server each time I have to return to the original setting of php.ini
5
3644
by: nawfer | last post by:
for to resize and copy original photos into a new directory and to use for a thumbnail gallery on the web; what is better: GD, Netpbm or imagemagick and why? very thank
1
12831
by: shanergb | last post by:
Hi all. I'm creating a web-based application that uses PHP, MySQL & Apache on a Windows platform. What I need to do is create images on the fly with either GD or ImageMagick, display them on the web browser and then save the file. The tricky part is the format of that saved file - it needs to be an EPS format. The image won't be anything terribly exciting - just some basic shapes (boxes, circles, etc) and some text. No fancy colors,...
6
2947
by: eholz1 | last post by:
Hello Users, I am not sure if this is the place to post an imagemagick question - please advise. I have imagemagick 6.3 installed, runs from command line ok, etc. I have tried (several times now) to install the "MagicWand" PHP api from the imagemagik site. This flatly refused to "make" configure seems ok, I follow the
2
2888
by: azrael | last post by:
Hy did anyone manage to work with imahemagick through python. I've been googling like a crazy for some instalation instructions, but i cant find anything. please help. thnx
0
1295
by: Tony Adamoli | last post by:
Can someone help me install ImageMagic on a Windows 2003 Small Business Server running PHP 5.2.5 and IIS 6.0? This has been driving me crazy all day. I have downloaded php_imagick.dll from the php4win.pecl.php.net site and copied it to my standard extentions directory. I have successfully installed the static 8-bit version of ImageMagick from their site. (ImageMagick works fine from the command line.) I have also added an...
0
1733
by: Tony Adamoli | last post by:
Can someone help me install ImageMagic on a Windows 2003 Small Business Server running PHP 5.2.5 and IIS 6.0? This has been driving me crazy all day. I have downloaded php_imagick.dll from the php4win.pecl.php.net site and copied it to my standard extentions directory. I have successfully installed the static 8-bit version of ImageMagick from their site. (ImageMagick works fine from the command line.) I have also added an...
0
8468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8901
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8660
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7415
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6213
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5683
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4209
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2799
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.