KatFennec |
05-05-2017 03:21 AM |
pngs for siggy
If your site is using .png images for the adoptables, and you want the full bbcode/html signature images to generate, all you need to do is just copy this into levelup.php after the if statement for GD to use a .gif for it.
PHP Code:
elseif(function_exists('imagepng') and $usegd == "yes" and $imagemime == "image/png"){ $usingimage = "yes"; //Turn the template system off $type = $this->adopt->getType(); list($width, $height, $type, $attr) = getimagesize($image); // The size of the original adoptable image
// Lets create the new target image, with a size big enough for the text for the adoptable $newheight = $height + 72; $newwidth = ($newwidth < 250)?250:$width; $img_temp = imagecreatetruecolor($newwidth, $newheight); $alphablending = true; // Lets create the image and save its transparency $img_old = @imagecreatefrompng($image); imagealphablending($img_old, true); imagesavealpha($img_old, true); // Lets copy the old image into the new image with ImageCopyResampled($img_temp, $img_old, 0, 0, 0, 0, $width, $height, $width, $height); $textheight = $width + 2; $image = $img_temp; $bgi = imagecreatetruecolor($newwidth, $newheight); $color = imagecolorallocate($bgi, 51, 51, 51); // Build text for siggy $str1 = "Name: ".$this->adopt->getName(); $str2 = "Owner: ".$this->adopt->getOwner(); $str3 = "Click Here to Feed Me!"; $str4 = "More Adopts at:"; $str5 = "www.".constant("DOMAIN");
// Renger Image imagestring ($image, 12, 0, $textheight, $str1, $color); imagestring ($image, 12, 0, $textheight + 13, $str2, $color); imagestring ($image, 12, 0, $textheight + 26, $str3, $color); imagestring ($image, 12, 0, $textheight + 42, $str4, $color); imagestring ($image, 12, 0, $textheight + 55, $str5, $color); $background = imagecolorallocate($image, 0, 0, 0); ImageColorTransparent($image, $background); // At the very last, let's clean up temporary files header("Content-Type: image/PNG"); ImageGif ($image); imagedestroy($image); imagedestroy($img_temp); imagedestroy($img_old); imagedestroy($bgi);
}
It simply took copying the entire if statement, and replacing each reference to gif with png. I imagine you could do the same for a jpg if you were so inclined.
The little blue tailed lass named "Tabs" in my signature is proof that this works.
|