Image Problem with PHP?
Posted: Fri Jan 24, 2003 11:58 am
Hello Everyone!!
I just can't get this working (which is <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> me off!). Altough I have been working with PHP for about 6 to 8 months now, my in deepth details of it suck!! So I thought I would build a web site using PHP. I have lots of ideas about what I wanted to do, one of them was to have a "Settings" option on the home page to change the background colour! Which I have working I can do that but I have two jpeg images on the home page which still have the defualt background colour on them!! As you can see form my script from below I have the RGB of my defualt colour (#CC9900) but all my script does is nothing!!! I have tried again and again to sort this problem out but can't!! What I can't seem to get myt head around is how can imagefill() work when I have not given it another colour to change the one that imagecolorallocate() is asked to find!? I have type it up wrong or are there better ways in which to to this? The colour I want the edges to be changed to are put into a cookie ($back), can anyone help??
if (!($image = @imagecreatefromjpeg("home1.jpg"))) {
$colorBack = imagecolorallocate($image, 204, 153, 0);
imagefill ($image, 0, 0, $colorBack);
header ("Content-type: image/jpeg");
imagejpeg($image);
} else {
print ("Can't load image!");
}
Glenn Curtis.
I just can't get this working (which is <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> me off!). Altough I have been working with PHP for about 6 to 8 months now, my in deepth details of it suck!! So I thought I would build a web site using PHP. I have lots of ideas about what I wanted to do, one of them was to have a "Settings" option on the home page to change the background colour! Which I have working I can do that but I have two jpeg images on the home page which still have the defualt background colour on them!! As you can see form my script from below I have the RGB of my defualt colour (#CC9900) but all my script does is nothing!!! I have tried again and again to sort this problem out but can't!! What I can't seem to get myt head around is how can imagefill() work when I have not given it another colour to change the one that imagecolorallocate() is asked to find!? I have type it up wrong or are there better ways in which to to this? The colour I want the edges to be changed to are put into a cookie ($back), can anyone help??
if (!($image = @imagecreatefromjpeg("home1.jpg"))) {
$colorBack = imagecolorallocate($image, 204, 153, 0);
imagefill ($image, 0, 0, $colorBack);
header ("Content-type: image/jpeg");
imagejpeg($image);
} else {
print ("Can't load image!");
}
Glenn Curtis.