Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-08-31T07:23:50-07:00
IM Version : 7.0.2
Code: Select all
convert -size 500x400 xc:none -fill white -stroke black -pointsize 20 -gravity center -annotate 0 "Some Text" output.gif
It is working good.
I\'m a boy
\"I\" \'m a boy
These are working.
\"I\" \'m a boy %d ==>
I am getting only "I" 'm a boy in the image. %d is missing.
What characters should be escaped. What are the security problem if i miss a escape?
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-08-31T08:50:12-07:00
Please give me the list of special characters
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-09-01T00:22:48-07:00
Is it possible to break and hack my above command if i just escape single and double quotes?
How can i escape #?
I am not able to escape the following two special characters.
# and &
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-09-01T07:59:52-07:00
agriz wrote: I am not able to escape the following two special characters.
# and &
Those characters are not special, to ImageMagick. In bash, provided they are within quotes, there is no need to escape them.
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-09-01T08:16:52-07:00
ok.
Another, final (might be
) problem.
"convert -size 500x400 xc:none -fill white -stroke black -pointsize 20 -gravity center -annotate 0 \"Some Text\" output.gif"
\"I\" \'m a boy => working (Double quotes is opened and close and working)
\"I am boy => not working (Double quotes is opened and not closed. Not working)
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-09-01T08:38:56-07:00
Please show the full commands you say are working or not working.
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-09-01T08:44:52-07:00
Code: Select all
$text = addslashes("I am a boy") => working;
$text = addslashes("I am a boy) => not working;
exec("convert -size 500x400 xc:none -fill white -stroke black -pointsize 20 -gravity center -annotate 0 \"".$text."\" output.gif");
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-09-01T09:16:20-07:00
agriz wrote: $text = addslashes("I am a boy)
Is this PHP? I suppose that is not a valid PHP statement.
agriz
Posts: 237 Joined: 2011-10-01T02:21:30-07:00
Authentication code: 8675308
Post
by agriz » 2016-09-01T18:48:39-07:00
I was getting that text from $_REQUEST['text']
That was not a valid php statement.
<input name="text" type="text" value=""I am a boy" />
$text = addslashes($_REQUEST['text']);