View Full Version : Siggy.php destroys outline.
trollis76
05-24-2009, 02:14 AM
On my transparent pictures, written on by the siggy.php some lose their outlines. This is bothering me deeply, and I don't know what is causing it.
The un-siggy pictures are not "destroyed".
Bloodrun
05-24-2009, 07:32 AM
Um.. outlines? What do you mean?
Try lowering the size of the files first. Then if that doesn't work, test different opacity layers, as well as none transparent photos.
I can't even get my siggy.php file to work. But that's alright.
trollis76
05-24-2009, 08:22 AM
Well, look at my signature and you'll understand. Thanks for the fast answer though.
Bloodrun
05-24-2009, 11:27 AM
Well, look at my signature and you'll understand. Thanks for the fast answer though.
I don't see any kind of border.
Make sure your image isn't to big meaning dimensions, I believe the siggy.php does have a dimensions size limitation.
trollis76
05-24-2009, 11:54 AM
Dimension? Sorry to be a noob, but what do you mean?
Bloodrun
05-24-2009, 12:15 PM
Dimension? Sorry to be a noob, but what do you mean?
100 X 100.
200 X 200.
50 X 75.
etc..
trollis76
05-24-2009, 02:11 PM
Well, the pictures are 80x80 BEFORE the siggy.php...
And this is my file:
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
//
// File ID: siggy.php
// Purpose: Show signature images for adoptables
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = grabanysetting("themeurl");
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
$links = getlinks();
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
// We need to grab an adoptable ID
$id = $_GET["id"];
$id = preg_replace("/[^a-zA-Z0-9s]/", "", $id);
$id = secure($id);
// Check that ID exists and is valid
if(is_numeric($id)){
// The ID appears to be valid, so double check...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
$isfrozen=@mysql_result($result,$i,"isfrozen");
$owner=@mysql_result($result,$i,"owner");
$i++;
}
if($aid == $id){
// The adoptable exists, so let's try and show the image
$usingimage = "no";
$image = getcurrentimage($id);
// Let's see if the server has support for GD or not
// Also to use fancy images the image must be a gif and fancy images must be enabled...
$usegd = grabanysetting("gdimages");
$imageinfo = @getimagesize($image);
$imagemime = $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...
if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif")
{
$usingimage = "yes"; //Turn the template system off
// BEGIN NEW CODE
list($width, $height, $type, $attr) = getimagesize($image); // The size of the original adoptable image
// Begin the fancy outputs...
// Lets create the new target image, with a size big enough for the text for the adoptable
$newheight = $height + 60;
if($newwidth < 100){
$newwidth = 100;
}
else{
$newwidth = $width;
}
$img_temp = imagecreatetruecolor($newwidth, $newheight);
$alphablending = true;
// Lets create the image and save its transparency
$img_old = @imagecreatefromgif($image);
imagealphablending($img_old, true);
imagesavealpha($img_old, true);
// Lets copy the old image into the new image with
// the given size
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);
$str1 = " ".$name;
$str2 = "Level ".$currentlevel;
imagestring ($image, 12, 0, $textheight, $str1, $color);
imagestring ($image, 12, 0, $textheight + 13, $str2, $color);
$background = imagecolorallocate($image, 0, 0, 0);
ImageColorTransparent($image, $background);
header("Content-Type: image/GIF");
ImageGif ($image);
imagedestroy($image);
imagedestroy($img_temp);
imagedestroy($img_old);
imagedestroy($bgi);
}
else{
// We are going to try and get this image the old fashioned way...
// Define a list of allowed file extentions...
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';
//Define the output file type
$contentType = 'Content-type: '.$extList[ $imageinfo['extension'] ];
if($imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){
// The file type is NOT ALLOWED
die("Hacking Attempt!");
}
else{
// File type is allowed, so proceed
// Try and read the file in
$status = "";
header ($contentType);
$status = readfile($image);
if($status == "" or $status == "false" or $status == "FALSE"){
// Reading the file failed, so show an error...
header ("text/plain");
die("Readfile appears to be disabled on your host.");
}
}
}
}
else{
// Bogus ID
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
}
else{
// Bogus ID
$article_title = $err_idnoexist;
$article_content = $err_idnoexist_text;
}
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
if($usingimage != "yes"){
echo $template; // Only echo the template if we are not showing an image...
}
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
BMR777
05-24-2009, 03:24 PM
It's probably due to the GD image library. The siggy.php file actually has to re-save your image file when it adds the signature text and it has been my experience that sometimes GD does not save transparencies properly, so that may be the issue here.
I'll continue to look into this and see if I can find a workaround to incorporate into a future release. :)
Bloodrun
05-24-2009, 07:35 PM
It's probably due to the GD image library. The siggy.php file actually has to re-save your image file when it adds the signature text and it has been my experience that sometimes GD does not save transparencies properly, so that may be the issue here.
I'll continue to look into this and see if I can find a workaround to incorporate into a future release. :)
What you might have to do, is make it where the script has an option to make the image transparent. Meaning the script will be the only thing that will make a normal image transparent. That's what I use for my TCG Makers, I can hand you the coding for the transparent option if you want.
BMR777
05-24-2009, 07:38 PM
Yeah, Bloodrun, if you could point me in the right direction of transparencies and GD that would be great as I could implement that in a future release.
Bloodrun
05-24-2009, 07:46 PM
Yeah, Bloodrun, if you could point me in the right direction of transparencies and GD that would be great as I could implement that in a future release.
Yeah, when I get to my laptop Ill hunt for that coding for you.
trollis76
05-25-2009, 08:14 AM
So... You can hand me that piece of script? Or?
Bloodrun
05-26-2009, 06:26 AM
So... You can hand me that piece of script? Or?
No, not you Brandon. The script needs to be put into the overall script for the next upgrade. If I hand it to you, it won't work, because yeah.
trollis76
05-26-2009, 07:34 AM
Oh... So...?
There is nothing I can do with the outline? :(
Bloodrun
05-26-2009, 10:16 AM
Oh... So...?
There is nothing I can do with the outline? :(
I'm still not understanding what you mean by an outline.
But for now, just use a non-transparent image.
I apologize for the in-convieniance on your part. =/
trollis76
05-27-2009, 12:20 AM
Non-transparent?? *DARN!!!!*
Bloodrun
05-27-2009, 08:51 AM
Non-transparent?? *DARN!!!!*
For right now no. Sorry.
trollis76
05-28-2009, 07:58 AM
*Humph. Then I'll just let the outline mess. Non-Transparent is 1000 times worser*
Thank you for the "help" though.
Bloodrun
05-28-2009, 08:12 AM
*Humph. Then I'll just let the outline mess. Non-Transparent is 1000 times worser*
Thank you for the "help" though.
Hey don't act like that. You can't honestly expect everything to work the first time around.
Now I can tell you we are trying to get it fixed, but that kind of attitude is really immature for something thats free. >_>
trollis76
05-28-2009, 08:41 AM
Yes I know. But don't expect a child to be mature. :)
mattalien
05-28-2009, 08:47 AM
Although I know what he means by the transparent outline. In the code for GD images, It makes a black background, then makes the black colour transparent. This also affects the sprites for his adoptables, as they have black outlines.
Hope this clears up any misunderstandings!
:)
trollis76
05-28-2009, 09:00 AM
*Her* adoptables. I am a "She".
Do you know where it states that it makes the bg black? 'Cause then I could change it into something else..?
mattalien
05-28-2009, 09:06 AM
Sorry.......
And I've tried that, but it didn't work.
the part is:
// Lets create the image and save its transparency
$img_old = @imagecreatefromgif($image);
imagealphablending($img_old, true);
imagesavealpha($img_old, true);
// Lets copy the old image into the new image with
// the given size
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);
$str1 = "Name: ".$name;
$str2 = "Owner: ".$owner;
$str3 = "Click Here to Feed Me!";
$str4 = "More Adopts at:";
$str5 = "www.".$domain;
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);
header("Content-Type: image/GIF");
ImageGif ($image);
imagedestroy($image);
imagedestroy($img_temp);
imagedestroy($img_old);
imagedestroy($bgi);
this part: $background = imagecolorallocate($image, 0, 0, 0);, is where it selects the colour.
trollis76
05-28-2009, 09:56 AM
Well... Then I need to figure out what those zeros mean. :)
Thank you Mattalien.[hr]
Googled a bit, and found that if you make the first zero a 225 it should be red instead of black... Going to test it though.
Bloodrun
05-28-2009, 09:59 AM
Well... Then I need to figure out what those zeros mean. :)
Thank you Mattalien.[hr]
Googled a bit, and found that if you make the first zero a 225 it should be red instead of black... Going to test it though.
php.net is your friend:
http://id2.php.net/manual/en/function.imagecolorallocate.php
trollis76
05-28-2009, 10:01 AM
Well... That was exactly what I found when I googled. ^^[hr]
I've fiddled a little bit 'round with the numbers, and it goes well except that it won't make it red and then transparent, but black and then keeping it that way. :)
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.