Page 1 of 1
how i can use the fred script with php?
Posted: 2014-11-29T14:05:01-07:00
by mostafanastary
Hi,
I need use some code from fred imagemagik example with php, the downloadable script is different.
any help please?
best regards.
Re: how i can use the fred script with php?
Posted: 2014-11-29T15:43:38-07:00
by fmw42
Please clarify what you are trying to do and which script. My scripts are unix bash shell scripts and should work fine using PHP in a unix system. I do not know if they work on Windows with PHP.
What script?
Is this for commercial use?
What is your platform and version of Imagemagick?
Did you review my Pointers on my home page?
I do not understand about using parts of the code? Why not the whole script? What is different about my script from what you want to do?
If you need some free code, see Anthony's web pages at
http://www.imagemagick.org/Usage/
Re: how i can use the fred script with php?
Posted: 2014-11-29T15:44:55-07:00
by Bonzo
I believe Fred has instructions on his site. But you need to upload the script and CHMOD it to either 777 or 755 depending on your server setup - one will work and the other wont so you will know when it is correct. You then need to find the full path to the script on your server.
Then use some code like this:
Code: Select all
// Where freds script is autotrim.sh and username is your server login name
exec(" /home/username/public_html/autotrim.sh zelda3_border2w.png fred.png ");
You will have to fill in any other variables depending on the script you are using
Re: how i can use the fred script with php?
Posted: 2014-11-29T16:21:26-07:00
by mostafanastary
thank for reply,
I found :
viewtopic.php?t=9631#p53156
part witch about exec() ,
i use exec() already but some of code in fred home page is ready to use, also those are amazing for work with imagemagick.
I try
viewtopic.php?t=9631#p53156 and i hope that work.
i use the lasted version of imagemagick on my linux server and use php for run my codes.
one Q:
is exec(" /home/username/public_html/autotrim.sh zelda3_border2w.png fred.png "); safe to use?
best regards.
Re: how i can use the fred script with php?
Posted: 2014-11-29T19:53:24-07:00
by fmw42
mostafanastary wrote:thank for reply,
i use the lasted version of imagemagick on my linux server and use php for run my codes.
one Q:
is exec(" /home/username/public_html/autotrim.sh zelda3_border2w.png fred.png "); safe to use?
best regards.
What is the latest version for your linux server? Please specify exactly the version number. If it is too old relative the current version 6.9.0.0, then the script may have problems running properly.
If you follow the instructions at
http://www.fmwconcepts.com/imagemagick/index.php, you should have no trouble with your command if you want the default behavior. Otherwise, you need to specify arguments. You need to find the path to IM convert (type -a convert) and put that in the variable described on that page. Your images must be in the same location as the script if you use the command above. Otherwise, put the full path to your images and to the script. Be sure the change the dir="." to dir="/tmp" and set the permissions of the file to chmon u+x. Also be sure the file you download is named the same as you have above, that is autotim.sh. Add the .sh if it is not in the downloaded file.