Hello people,
I want to do a website page you may see following:
As you can see in the image, the generated text has got different font (DecoTech) and the text-color is white.
I have read some topics in forum but couldnt find how to do this in website platform. Can I do this in my website with using imagemagick? If so can someone show me the some example?
Thank you.
writing text on selected image in website
Re: writing text on selected image in website
I have quite a few php and Imagemagick examples on my website and this one has most of what you want except the user is uploading the image as well as the text: http://www.rubblewebs.co.uk/imagemagick ... t_form.php
BUT this is some old and basic code and would need more security and user input verification.
BUT this is some old and basic code and would need more security and user input verification.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: writing text on selected image in website
Imagemagick will write the selected text to whatever image is selected. But it cannot do the web viewing and selecting from menus. That will require PHP. The appropriate imagemagick command to do the writing of text can be done using PHP exec(). See Bonzo's web site for numerous examples of PHP and Imagemagick
Re: writing text on selected image in website
I used the code in this page : http://www.rubblewebs.co.uk/imagemagick ... t_form.php (Thank you so much)
Actually it worked. It generates a new image with same name of image file also it writes a text I want to write on. But I can not change the font type and can not set the coordinates.
After I click to submit button it gives me this error:
Array ( [0] => convert.exe: unable to open image `rgba\(0,0,0,0.4\)': No such file or directory @ error/blob.c/OpenBlob/2617. [1] => convert.exe: no decode delegate for this image format `rgba\(0,0,0,0.4\)' @ error/constitute.c/ReadImage/544. [2] => convert.exe: unable to read font `arial.ttf' @ warning/annotate.c/RenderType/871. )
There were some errors during the Imagemagick conversion:
1
Can anyone help me?
Actually it worked. It generates a new image with same name of image file also it writes a text I want to write on. But I can not change the font type and can not set the coordinates.
After I click to submit button it gives me this error:
Array ( [0] => convert.exe: unable to open image `rgba\(0,0,0,0.4\)': No such file or directory @ error/blob.c/OpenBlob/2617. [1] => convert.exe: no decode delegate for this image format `rgba\(0,0,0,0.4\)' @ error/constitute.c/ReadImage/544. [2] => convert.exe: unable to read font `arial.ttf' @ warning/annotate.c/RenderType/871. )
There were some errors during the Imagemagick conversion:
1
Can anyone help me?
Re: writing text on selected image in website
You need the font you are going to use in the same folder as the code. If the arial font is built into your version of Imagemagick you would just need Arial or what ever your font is called.
Are you on a Windows or Linux server? If Windows use -fill rgba(0,0,0,0.4) instead of -fill rgba\(0,0,0,0.4\)
Are you on a Windows or Linux server? If Windows use -fill rgba(0,0,0,0.4) instead of -fill rgba\(0,0,0,0.4\)
Re: writing text on selected image in website
Thank you so much Bonzo! now it works perfect : )
I am using windows.
I am using windows.
Re: writing text on selected image in website
That's good Leo7; there are some differences between Windows and Linux usage: http://www.imagemagick.org/Usage/windows/