Page 1 of 1
access issue
Posted: 2009-10-23T23:22:08-07:00
by onish
My php pages are on Server1 and my images are on Server2 on same network (the folder on server 2 is accessed as a mapped drive R: on server1).
When I execute 'identify //server2/folder/image.jpg' from command prompt, it works fine.
But when I run the same from PHP, it does nothing.
What could be wrong?
Re: access issue
Posted: 2009-10-24T11:05:02-07:00
by fmw42
did you specify the full path to identify or convert, etc. also for textual output you may need to add 2>&1
Re: access issue
Posted: 2009-10-25T22:08:08-07:00
by onish
Thanks for your reply, I really appreciate...
Here is some more information on the environment I am working with:
1) I am using ImageMagick with PHP in a Windows environment. Both the servers are Windows 2003
2) The ImageMagick is installed at C:\Program Files\ImageMagick-6.5.3-Q16.
3) Needed rights on convert.exe, compose.exe and identify.exe are specified.
4) While calling the executable from PHP script I am specifying the absolute path to the executable:
C:\Progra~1\ImageMagick-6.5.3-Q16\
5) Everything works fine if the script runs on the same machine where ImageMagick is installed. But it fails (without any errors) when I pass path to the remote files, which resides on server 2.
6) For your reference, here is the command I am trying to execute:
C:\Progra~1\ImageMagick-6.5.3-Q16\convert \\192.168.1.50\folder\subfolder\image.jpg \\192.168.1.50\folder\subfolder\image.png
7) I would also like you to know that the same scripts are able to create files on remote server in my local environment, which is Windows XP SP2. The LIVE environment is windows 2003 and my dev environment is Windows XP SP2.
One more thing I would like you to know is that I am able to execute the mentioned command from the command prompt of Windows 2003 Server 1. But the same command fails from PHP script. I think it has something to do with the permissions, which I think I have configured correctly.
I hope this helps you. I know, I realize that I should have posted this information while creating the thread.
Waiting for your reply. Thanks.
Re: access issue
Posted: 2009-11-20T03:31:16-07:00
by onish
Hi Guys,
I really need help with this and would really appreciate any kind of assistance with it. Thanks.
Re: access issue
Posted: 2009-11-20T04:24:55-07:00
by onish
Hi fmw42,
I tried after adding 2>&1 at the end of the command as you suggested and got the below mentioned message:
Command:
C:\Progra~1\ImageMagick-6.5.3-Q16\identify \\192.168.1.50\folder\subfolder\01.jpg 2>&1
Output Message
identify: unable to open image `\\192.168.1.50\folder\subfolder\01.jpg': Invalid argument @ blob.c/OpenBlob/2489.
This is really strange as the same command runs just fine directly from the command prompt. I am confused because PHP also uses the same command prompt to execute ImageMagick commands.
Re: access issue
Posted: 2009-11-20T11:11:50-07:00
by fmw42
I am not that knowledgeable about PHP and IM. See
http://www.rubblewebs.co.uk/index.php for good information about it or ask user Bonzo. Perhaps he can give you more pointers.
Sounds like a PHP permissions problem, but as I said, I am not that expert on these matters.
see Bonzo's response about PHP on Windows platforms at
viewtopic.php?f=1&t=14699
Re: access issue
Posted: 2009-11-20T12:08:50-07:00
by Bonzo
I would say its not finding the image and to be honist I do not know what the problem is
Imagemagick works on server 1 and converts, identifys images on server 1 OK using the path to convert as C:\Progra~1\ImageMagick-6.5.3-Q16\identify ( out of interest can you not just use identify ).
When you get the path to the image on server 2 from server 1 that is //192.168.1.50/folder/subfolder/01.jpg and you have changed it to \\192.168.1.50\folder\subfolder\01.jpg in the code ?
Would R:\\folder\subfolder\01.jpg work ?
What happens if you try saving to server 1 instead of server 2 ?
This code works for me using php on a localhost ( XAMPP ) but I have no way to test a networked drive, does it work for you ? You may need the full path to convert not just convert.
Code: Select all
<?php
exec("convert http://www.imagemagick.org/discourse-server/styles/prosilver/imageset/site_logo.png IM_logo.png");
?>
Re: access issue
Posted: 2009-11-22T21:36:38-07:00
by onish
Thanks a lot fmw42 and Bonzo, I really appreciate you inputs on this.
I agree with fmw42 and somewhere back in my mind I still think that it has something to do with the permissions but I am not able to figure out the problem. The permissions are all good and as I mentioned everything works from the command prompt, the convert.exe successfully executes and does what I ask it to do.
Bonzo, I will definitely keep in mind your pointers and test few more things and get back to you guys.
Thanks again
Re: access issue
Posted: 2009-11-29T23:10:09-07:00
by onish
Hi Guys,
I would like to close this issue. It turns out to be a PHP permission problem and I was thinking that there was something wrong with my implementation at ImageMagick end.
I really appreciate your inputs.
Regards