Thread: pngs for siggy
View Single Post
  #1  
Old 05-05-2017, 03:21 AM
KatFennec's Avatar
KatFennec KatFennec is offline
Member
 
Join Date: Apr 2017
Posts: 57
Gender: Female
Credits: 7,861
KatFennec is on a distinguished road
Default 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_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// 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 ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
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.
__________________
Reply With Quote