|
-
Oct 22nd, 2003, 08:29 PM
#1
Thread Starter
Hyperactive Member
ImageTransparency
I am having problems with Image Transparency, My images I have go in as Transparent, but when I out put them, they arent. Am I doing my imagetransparency function wrong?
PHP Code:
function player($guy, $shirt) {
$image = ImageCreateTrueColor($im_x_guy, $im_y_guy);
$im_guy = ImageCreateFromPNG("images/rpg/clothing/$guy");
$im_x_guy = ImageSX($im_guy);
$im_y_guy = ImageSY($im_guy);
$im_color = ImageColorAllocate($image, 0, 0, 0);
ImageColorTransparent($image, $im_color);
ImageCopy($image, $im_guy, 0, 0, 0, 0, $im_x_guy, $im_y_guy);
if ($shirt !== '0'){
$im_shirt = ImageCreateFromPNG("images/rpg/clothing/$shirt");
$im_x_shirt = ImageSX($im_shirt);
$im_y_shirt = ImageSY($im_shirt);
ImageCopy($image, $im_shirt, 0, 0, 0, 0, $im_x_shirt, $im_y_shirt);
}
header ("Content-type: image/png");
ImagePNG($image);
ImageDestroy($image);}
Any help would be GREATLY apreciated.
-
Oct 22nd, 2003, 08:32 PM
#2
Stuck in the 80s
Did you check out any of the comments in the PHP manual to see if they'd help? http://www.php.net/ImageColorTransparent
-
Oct 22nd, 2003, 08:37 PM
#3
Thread Starter
Hyperactive Member
Yeah, I did, I tried like 3 of them, but It doesnt seem to work. Could it be that my server doesnt support ImageTransparency for some reason?
-
Oct 22nd, 2003, 09:21 PM
#4
I'm not totally sure if this will do it, but you could try moving your declaration of the transparent color to after the if statement..
PHP Code:
if ($shirt !== '0'){
$im_shirt = ImageCreateFromPNG("images/rpg/clothing/$shirt");
$im_x_shirt = ImageSX($im_shirt);
$im_y_shirt = ImageSY($im_shirt);
ImageCopy($image, $im_shirt, 0, 0, 0, 0, $im_x_shirt, $im_y_shirt);
}
//move transparency declaration
ImageColorTransparent($image, $im_color);
header ("Content-type: image/png");
ImagePNG($image);
ImageDestroy($image);}
-
Oct 23rd, 2003, 09:39 AM
#5
Thread Starter
Hyperactive Member
Alright, Ill try it out and let you know how it turns out.
-
Oct 25th, 2003, 01:25 AM
#6
Frenzied Member
does your server have GD Library 2.0, because you have to have it for it to work.
-
Oct 27th, 2003, 05:24 PM
#7
Thread Starter
Hyperactive Member
["GD Version"]=> string(27) "bundled (2.0.15 compatible)"
thats the version I have, it should work shouldnt it?
-
Oct 27th, 2003, 05:34 PM
#8
Frenzied Member
where did you get that? what does it say when you run phpinfo() ?
-
Oct 28th, 2003, 09:57 PM
#9
Thread Starter
Hyperactive Member
Hrm... It says it in phpinfo? ill have to check that, anyways, i got that from gd_info();, however its best to probably display it with var dump:
PHP Code:
<?php
var_dump(gd_info());
?>
-
Oct 28th, 2003, 10:05 PM
#10
Thread Starter
Hyperactive Member
according to phpinfo() i have 2.0.15
-
Oct 28th, 2003, 10:14 PM
#11
Frenzied Member
where are these coming from?
$im_x_guy, $im_y_guy
also I don't know any phpinfo that displays the full version. mine says "bundled (2.0 compatible)"
anyway, where are those variables coming from?
-
Oct 29th, 2003, 11:07 PM
#12
Originally posted by phpman
where are these coming from?
$im_x_guy, $im_y_guy
also I don't know any phpinfo that displays the full version. mine says "bundled (2.0 compatible)"
anyway, where are those variables coming from?
did you read the posted code?
PHP Code:
function player($guy, $shirt) {
$image = ImageCreateTrueColor($im_x_guy, $im_y_guy);
$im_guy = ImageCreateFromPNG("images/rpg/clothing/$guy");
$im_x_guy = ImageSX($im_guy);
$im_y_guy = ImageSY($im_guy);
$im_color = ImageColorAllocate($image, 0, 0, 0);
-
Oct 29th, 2003, 11:25 PM
#13
Frenzied Member
uhh look again
Code:
function player($guy, $shirt) {
$image = ImageCreateTrueColor($im_x_guy, $im_y_guy);
$im_guy = ImageCreateFromPNG("images/rpg/clothing/$guy");
$im_x_guy = ImageSX($im_guy);
$im_y_guy = ImageSY($im_guy);
he calls them before he sets them.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|