Hello Webmasters
i have desghned a user input form where user can choose one of the colors from color picker ,i have used imagemagick code in an out put page where it display a colored text(choosen by user).... It is a very simple script which works fine when tyhe user enters color name but does not work when we enter color hexa decimal..... i got to know when we use hexa decimal we need to enter in this way " '#00ff345' " ...i tried same thing which worked fine again but what sall i do when using color picker ??? it enter #00ff345 ...it will not enter ' ' ....without this quote it does not accept color codes... how do i fix it??????
hexa color codes not accepting in image magickk..please help
Re: hexa color codes not accepting in image magickk..please
What code are you using; php?
If so I assume you have #00ff345 in a variable something like $colour_varible='#00ff345'; so you could:
Then use $variable in your code.
I would have thought it was OK to have the colour name between ' ' as well but you would need to test that.
If so I assume you have #00ff345 in a variable something like $colour_varible='#00ff345'; so you could:
Code: Select all
$colour_varible='#00ff345';
$variable = "'$colour_varible'";
I would have thought it was OK to have the colour name between ' ' as well but you would need to test that.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: hexa color codes not accepting in image magickk..please
If you use hex or rgb values in IM, you need to reference them with quotes. But if you use variables to hold them then you need to use double quotes so that the variable can be parsed.
convert -size 100x100 xc:"#FF0000" ....
or
color="#FF0000"
convert -size 100x100 xc:"$color" ....
see
http://www.imagemagick.org/script/color.php
In PHP you need to be careful about nested quotes also.
convert -size 100x100 xc:"#FF0000" ....
or
color="#FF0000"
convert -size 100x100 xc:"$color" ....
see
http://www.imagemagick.org/script/color.php
In PHP you need to be careful about nested quotes also.
Re: hexa color codes not accepting in image magickk..please
thanks a lot for your reply guyz ..... here is the code iam using...
we can get output from any color picker in the form of #ff001236 ... but i need the out put in the form of '#ff001236' ...so that it can be accepted by imagemagick.... any idea guyzzzzz????
'fill' is the color variable i have used in input form ...
Code: Select all
<?php
if (isset($_POST['fill']) && isset($_POST['label']) && isset($_POST['pointsize'])) {
$cmd =" -background NONE -pointsize ". $_POST['pointsize'] ." -font Times-Roman -fill ". $_POST['fill'] . " ".
" -strokewidth 1 -stroke black label:\" ".$_POST['label'] . "\" ";
exec("convert $cmd 1.png");
echo "<img src='1.png'>";
}
else{
echo "ERROR";
}
?>
we can get output from any color picker in the form of #ff001236 ... but i need the out put in the form of '#ff001236' ...so that it can be accepted by imagemagick.... any idea guyzzzzz????
'fill' is the color variable i have used in input form ...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: hexa color codes not accepting in image magickk..please
I am not much of a PHP expert but try
\"$_POST['fill']\"
\"$_POST['fill']\"
Re: hexa color codes not accepting in image magickk..please
any idea on how can we fix this problem.. is it possible to use color picker in this case (which outputs only hexa code)... if yes which is the color picker we can try ...i tried js color picker ....but no luck... please help me...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: hexa color codes not accepting in image magickk..please
Have you seen the Color Convert (PHP app) that is near the top of http://www.imagemagick.org/script/color.php. Created by Bonzo and myself
Re: hexa color codes not accepting in image magickk..please
but how can i use color converter in place of color picker???
Re: hexa color codes not accepting in image magickk..please
There are loads of color pickers here: http://www.hotscripts.com/search/all-sc ... lor+picker