The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Off-Topic (https://www.pokecommunity.com/forumdisplay.php?f=23)
-   -   PNG GD images with PHP (https://www.pokecommunity.com/showthread.php?t=38212)

Pokedragonfire May 8th, 2005 2:27 PM

PNG GD images with PHP
 
Okay, is there anyway to put an alpha-transparent png onto another image? And then change it into a gif/jpg?
I heard you can't use alpha-transparent pngs.

EDIT: Also, can you merge more than 2 images into one image file?

Geometric-sama May 10th, 2005 4:40 PM

For the merging thing, if you know how to merge two images just merge them and then merge another on top... no idea about the other.

Pokedragonfire May 10th, 2005 5:27 PM

Quote:

Originally Posted by Jedi_Amara
For the merging thing, if you know how to merge two images just merge them and then merge another on top... no idea about the other.

Yeah I tried that but my code's probably messed up or something =/

PHP Code:

header('content-type: image/jpeg');  

$watermark imagecreatefrompng('hat.png');  
$watermark_width imagesx($watermark);  
$watermark_height imagesy($watermark);  
$image imagecreatetruecolor($watermark_width$watermark_height);  

$image imagecreatefrompng('griffin.png');  
$size getimagesize('griffin.png');  
$dest_x $size[0] - $watermark_width 5;  
$dest_y $size[1] - $watermark_height 5;  

$test imagecopymerge($image$watermark$dest_x$dest_y00$watermark_width$watermark_height100); 

$watermark2 imagecreatefrompng('scarf.png');  
$watermark_width2 imagesx($watermark2);  
$watermark_height2 imagesy($watermark2);  
$image2 imagecreatetruecolor($watermark_width2$watermark_height2);  

imagecopymerge($test$watermark2$dest_x$dest_y00$watermark_width2$watermark_height2100); 
imagejpeg($image2);
imagedestroy($image);  
imagedestroy($image2);  
imagedestroy($watermark);
imagedestroy($watermark2); 

I'm tired and I bet it has a whole load of errors. I got this off a site and modified it.
I wish they would make a new verision of GD that let's you merge 24-bit alpha transparent pngs.

Geometric-sama May 11th, 2005 8:44 PM

You could go to their website and suggest it~

I'll have a look at the code later, I don't have time right now. You could ask Gary if he'll look at it.

Kipkip May 12th, 2005 11:21 AM

Quote:

Originally Posted by Jedi_Amara
You could go to their website and suggest it~

I'll have a look at the code later, I don't have time right now. You could ask Gary if he'll look at it.

Yeah, I really have no clue on how to merge images since I skipped that chapter in my book. But thanks for reminding me to read that chapter. Sorry that I can't help right now.

Geometric-sama May 13th, 2005 7:50 PM

*giggles* I'll admit I said for you to look at it because I skipped over that chapter in my book too. :P I went to advanced array operations instead XD


All times are GMT -8. The time now is 5:51 PM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.