Results 1 to 13 of 13

Thread: ImageTransparency

  1. #1

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393

    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($image000);

    ImageColorTransparent($image$im_color);

    ImageCopy($image$im_guy0000$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_shirt0000$im_x_shirt$im_y_shirt);
    }

    header ("Content-type: image/png");
    ImagePNG($image);
    ImageDestroy($image);} 

    Any help would be GREATLY apreciated.
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  2. #2
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Did you check out any of the comments in the PHP manual to see if they'd help? http://www.php.net/ImageColorTransparent
    My evil laugh has a squeak in it.

    kristopherwilson.com

  3. #3

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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?
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    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_shirt0000$im_x_shirt$im_y_shirt); 


    //move transparency declaration
    ImageColorTransparent($image$im_color);

    header ("Content-type: image/png"); 
    ImagePNG($image); 
    ImageDestroy($image);} 
    Like Archer? Check out some Sterling Archer quotes.

  5. #5

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    Alright, Ill try it out and let you know how it turns out.
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  6. #6
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,333
    does your server have GD Library 2.0, because you have to have it for it to work.

  7. #7

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    ["GD Version"]=> string(27) "bundled (2.0.15 compatible)"

    thats the version I have, it should work shouldnt it?
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  8. #8
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,333
    where did you get that? what does it say when you run phpinfo() ?

  9. #9

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    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());
    ?>
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  10. #10

    Thread Starter
    Hyperactive Member flame_211's Avatar
    Join Date
    Jun 2000
    Location
    I dont really think I know where I am???
    Posts
    393
    according to phpinfo() i have 2.0.15
    Reach me at:
    AIM: FlameWide
    AIM: Itz deep6
    MSN/Email: flame_gandalf@hotmail.com

    Check out these sites:
    My Blog

  11. #11
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,333
    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?

  12. #12
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    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($image000); 
    Like Archer? Check out some Sterling Archer quotes.

  13. #13
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,333
    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
  •  



Click Here to Expand Forum to Full Width