Page 1 of 1
writing text on selected image in website
Posted: 2015-04-12T03:28:49-07:00
by Leo7
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.
Re: writing text on selected image in website
Posted: 2015-04-12T04:50:53-07:00
by Bonzo
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.
Re: writing text on selected image in website
Posted: 2015-04-12T08:15:41-07:00
by fmw42
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
Posted: 2015-04-18T12:17:39-07:00
by Leo7
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?
Re: writing text on selected image in website
Posted: 2015-04-18T12:45:44-07:00
by Bonzo
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\)
Re: writing text on selected image in website
Posted: 2015-04-18T14:58:41-07:00
by Leo7
Thank you so much Bonzo! now it works perfect : )
I am using windows.
Re: writing text on selected image in website
Posted: 2015-04-19T00:29:53-07:00
by Bonzo
That's good Leo7; there are some differences between Windows and Linux usage:
http://www.imagemagick.org/Usage/windows/