Page 1 of 1

Unrotate script

Posted: 2008-12-28T03:25:02-07:00
by Thomisback
Hi,

I don't know a lot about imagemagick but what I'm basicly trying to do is unrotate a picture using this script:
http://www.fmwconcepts.com/imagemagick/ ... /index.php
by running it in a .PHP file.

So let's say
- I save the unrotate script as unrotate.sh
- I have got a picture saved as "picture.jpg"
- I create a PHP file with the following code:

Code: Select all

<?PHP
$output = shell_exec('bash ./unrotate.sh -f 40 picture.jpg picture_new.jpg');
echo "<pre>$output</pre>";
?>
But when I then try to run my PHP script it returns me the following error:

Code: Select all

--- FILE picture.jpg DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---
While the file does exist and is readable....

Any suggestions?
Thanks a lot.

Re: Unrotate script

Posted: 2008-12-28T09:34:31-07:00
by el_supremo
That message is coming from Fred's script.
I presume that you have picture.jpg in the same directory as the unrotate.sh script, if not then that's the problem.

If you do then you could try to execute the command that is failing in Fred's script. See if this command gives you any errors or warnings:

Code: Select all

convert -quiet -regard-warnings picture.jpg +repage junk.jpg
Pete

Re: Unrotate script

Posted: 2008-12-28T10:50:01-07:00
by Thomisback
Hi,

Thanks for your reply, everything is in the same folder and I just tried executing your code by doing this:

Code: Select all

<?PHP
$output = shell_exec('convert -quiet -regard-warnings picture.jpg +repage junk.jpg');
echo "<pre>$output</pre>";
?>
and also like this:

Code: Select all

<?PHP
$cmd="convert -quiet -regard-warnings picture.jpg +repage junk.jpg";
system($cmd);
?>
Which doesn't return anything... just a blank page.
Anyone knows why?
Thanks a lot & kind regards

Re: Unrotate script

Posted: 2008-12-28T10:52:53-07:00
by Thomisback
Oh I just tried to run this code I posted above on my local PC and that seemed to work and actually created a file called junk.jpg. No further error messages though. But when I try to execute the same piece of code on my web hosting it does not create a picture?

Re: Unrotate script

Posted: 2008-12-28T17:41:26-07:00
by fmw42
Thomisback wrote:Hi,

Thanks for your reply, everything is in the same folder and I just tried executing your code by doing this:

Code: Select all

<?PHP
$output = shell_exec('convert -quiet -regard-warnings picture.jpg +repage junk.jpg');
echo "<pre>$output</pre>";
?>
and also like this:

Code: Select all

<?PHP
$cmd="convert -quiet -regard-warnings picture.jpg +repage junk.jpg";
system($cmd);
?>
Which doesn't return anything... just a blank page.
Anyone knows why?
Thanks a lot & kind regards


You probably need to provide the full path to convert, something like, /usr/local/bin/convert, or where ever your provider has put IM.

Re: Unrotate script

Posted: 2008-12-29T00:11:22-07:00
by Thomisback
Hi, thanks for your reply.

I looked up the location where IM is located and my hosting website's FAQ states:

Code: Select all

The convert path to ImageMagick, version 6 on our servers is:
/usr/local/bin/
So I tried both:

Code: Select all

<?PHP
$cmd="/usr/local/bin/convert -quiet -regard-warnings picture.jpg +repage picture_new.jpg";
system($cmd);
?>
and:

Code: Select all

<?PHP
$output = shell_exec('/usr/local/bin/convert -quiet -regard-warnings picture.jpg +repage picture_new.jpg');
echo "<pre>$output</pre>";
?>
Still no picture is being created...

Re: Unrotate script

Posted: 2008-12-29T13:44:22-07:00
by fmw42
Thomisback wrote:Hi, thanks for your reply.

I looked up the location where IM is located and my hosting website's FAQ states:

Code: Select all

The convert path to ImageMagick, version 6 on our servers is:
/usr/local/bin/
So I tried both:

Code: Select all

<?PHP
$cmd="/usr/local/bin/convert -quiet -regard-warnings picture.jpg +repage picture_new.jpg";
system($cmd);
?>
and:

Code: Select all

<?PHP
$output = shell_exec('/usr/local/bin/convert -quiet -regard-warnings picture.jpg +repage picture_new.jpg');
echo "<pre>$output</pre>";
?>
Still no picture is being created...

get rid of the excess arguments and try just

/usr/local/bin/convert picture.jpg picture_new.jpg

Also see my private note to you about checking if you can actually access IM and get the version numbers back. Also look at the rubbleweb web site of Bonzo (see my private message also for that).

Fred

Re: Unrotate script

Posted: 2009-01-04T07:06:17-07:00
by Thomisback
Hi thanks for your reply!

Code: Select all

<?php
$cmd="/usr/local/bin/convert picture.jpg picture_new.jpg";
system($cmd);
?>
Worked fine and created a file, I checked IM version and path and these are set correctly. I will try to figure it out from here (But suggestions are welcome!).
Thanks a lot.