tawxic Posted November 5, 2003 Share Posted November 5, 2003 now it wont show anything but a red x again (when viewed as a php file) and nothing at all as a jpg (but you can view source my code)..this is frustrating... it should work fine...my about-bg.gif:my siggy.php code:<?phpHeader ('Content-type: image/png');Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');Header('Pragma: no-cache');// create the image$image = imagecreatefromgif("/var/www/html/signature/about-bg.gif");// set the colours$cool = imagecolorallocate($image, 87, 87, 87);$black = imagecolorallocate($image, 0, 0, 0);$white = imagecolorallocate($image, 255, 255, 255);$red = imagecolorallocate($image, 255, 0, 0);$grey = imagecolorallocate($image, 204, 204, 204);$green = imagecolorallocate($image, 206, 129, 18);$blue = imagecolorallocate($image, 0, 0, 255);// counter$viewss = file("/var/www/html/signature/views.txt");$views = $viewss[0]; $views++;$fp = fopen("/var/www/html/signature/views.txt", "w");fwrite($fp, $views);fclose($fp);$counter = "Phazm Graphics - $views people served since 11/5/03!";// define geek code$nerd = "-----BEGIN NERD CODE BLOCK-----Version: 1.2a01001101011110010010000001110011011010010110011101100111011110010010000001110111011010010110110001101100001000000111001101101111011011110110111000100000011100100110111101100011011010110010000100100000------END NERD CODE BLOCK------";// line style line$line = "________________________________________________________";// set the font and print text$font = '/var/www/html/verdana.ttf';ImageTTFText ($image, 8, 0, 12, 45, $black, $font, $nerd);ImageTTFText ($image, 8, 0, 12, 148, $black, $font, $line);ImageTTFText ($image, 8, 0, 12, 180, $black, $font, $counter);// output and destroyimagepng($image);imagedestroy($image);?>(note that I tried using relative links again, no difference that I could see)and that's really all I need to have... htaccess would be if I viewed it a a jpg, so it opened it as a php document instead of a jpg file.. but It already has a php extension...(I added it anyway) Link to comment Share on other sites More sharing options...
gamehead200 Posted November 5, 2003 Share Posted November 5, 2003 I know exactly what the problem is...Make sure there is a file called "view.txt" in the same folder and make you CHMOD it to 666 or esle it won't work... And also make sure your image is 128 colors...GD will not work properly if you have an image with over 128 colors...Yours had over that many, so I edited it in Photoshop for you...It looks extremely similar...Here is the code I used for YOUR about.png:<?phpHeader ('Content-type: image/png');Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');Header('Pragma: no-cache');// create the image$image = imagecreatefromgif("about-bg.gif");// set the colours$cool = imagecolorallocate($image, 87, 87, 87);$black = imagecolorallocate($image, 0, 0, 0);$white = imagecolorallocate($image, 255, 255, 255);$red = imagecolorallocate($image, 255, 0, 0);$grey = imagecolorallocate($image, 204, 204, 204);$green = imagecolorallocate($image, 206, 129, 18);$blue = imagecolorallocate($image, 0, 0, 255);// counter$viewss = file("views.txt");$views = $viewss[0]; $views++;$fp = fopen("views.txt", "w");fwrite($fp, $views);fclose($fp);$counter = "Phazm Graphics - $views people served since 11/5/03!";// define geek code$nerd = "-----BEGIN NERD CODE BLOCK-----Version: 1.2a01001101011110010010000001110011011010010110011101100111011110010010000001110111011010010110110001101100001000000111001101101111011011110110111000100000011100100110111101100011011010110010000100100000------END NERD CODE BLOCK------";// line style line$line = "________________________________________________________";// set the font and print text$font = 'verdana.ttf';ImageTTFText ($image, 8, 0, 45, 35, $white, $font, $nerd);ImageTTFText ($image, 8, 0, 45, 138, $white, $font, $line);ImageTTFText ($image, 8, 0, 45, 170, $white, $font, $counter);// output and destroyimagepng($image);imagedestroy($image);?>And here is the edited background: Link to comment Share on other sites More sharing options...
tawxic Posted November 5, 2003 Share Posted November 5, 2003 nope! That didn't work either..this is the error I'm getting in my errorlog(I should've checked this a log time ago)[05-Nov-2003 17:17:33] PHP Fatal error: Call to undefined function: imagecreatefromgif() in /var/www/html/signature/siggy.php on line 9no idea why that fuction wouldn't be supported... Link to comment Share on other sites More sharing options...
tawxic Posted November 5, 2003 Share Posted November 5, 2003 okay, it IS somethign with my host, because I have it on my companies website just fine... www.rfstorm.com/sig/siggy.php Link to comment Share on other sites More sharing options...
tawxic Posted November 5, 2003 Share Posted November 5, 2003 got it to work in jpg and png format on my companies host :-/ Link to comment Share on other sites More sharing options...
gamehead200 Posted November 6, 2003 Share Posted November 6, 2003 got it to work in jpg and png format on my companies host :-/Copy cat! Link to comment Share on other sites More sharing options...
tawxic Posted November 6, 2003 Share Posted November 6, 2003 lol, I don't plan on keeping the design, don't worry, it's just a placeholder :-PAnyhow, I figured out that my GD version is the one that createimagefromgif doesn't work (d'oh!) so I made it "createimagefrompng" and now it works, but for some odd reason it indents to text:http://www.phazm.net/signature/siggy.phphowever, I cannot view anything other than .php, (e.g. jpg or png) - so I think my host has htaccess disabled maybe? not sure... I'll email em tonight...Hey, I just want to say I'm greatful for all your help gamehead, I couldn't have gotten close to this far without you! Link to comment Share on other sites More sharing options...
gamehead200 Posted November 6, 2003 Share Posted November 6, 2003 lol, I don't plan on keeping the design, don't worry, it's just a placeholder :-PAnyhow, I figured out that my GD version is the one that createimagefromgif doesn't work (d'oh!) so I made it "createimagefrompng" and now it works, but for some odd reason it indents to text:http://www.phazm.net/signature/siggy.phphowever, I cannot view anything other than .php, (e.g. jpg or png) - so I think my host has htaccess disabled maybe? not sure... I'll email em tonight...Hey, I just want to say I'm greatful for all your help gamehead, I couldn't have gotten close to this far without you!tawxic, its impossible that your host disabled .htaccess files, or else the image would not have been parsed...In this case, it was, so .htaccess was enabled...And BTW, you should have been there to see what I had to go through to figure out how to do this on other forums...I even showed XPerties how to do one for eMax Hosting which he got rid of (I think...) ! Link to comment Share on other sites More sharing options...
tawxic Posted November 6, 2003 Share Posted November 6, 2003 hehe.Well, what do you think it could be then? It works fine on another host, but not this one? obviously something is different that is causing mine to be uncompatible Link to comment Share on other sites More sharing options...
tawxic Posted November 6, 2003 Share Posted November 6, 2003 I updated my script, not it displays a random quote:but is there any way to center the quote vertically? (so it's the same distance from the top to the bar) Link to comment Share on other sites More sharing options...
un4given1 Posted November 6, 2003 Share Posted November 6, 2003 tawxic: hate to burst your bubble dewd, but the new sig policy doesn't allow you to have a sig that big. Link to comment Share on other sites More sharing options...
tawxic Posted November 6, 2003 Share Posted November 6, 2003 tawxic: hate to burst your bubble dewd, but the new sig policy doesn't allow you to have a sig that big.after I get this thing fine tuned, I will make a smaller version.. this will be my version for other pages. Link to comment Share on other sites More sharing options...
gamehead200 Posted November 7, 2003 Share Posted November 7, 2003 Don't worry, the sig rule changed back AGAIN...You can keep that sig... Link to comment Share on other sites More sharing options...
bman3022 Posted November 23, 2003 Share Posted November 23, 2003 Hi can some one help me with this?I made it using this to make it<?phpheader ("Content-type: image/png");Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');Header('Pragma: no-cache');$image = imagecreatefromgif("bg.gif");$back_color = ImageColorAllocate ($image, 0, 10, 10);$white = ImageColorAllocate($im, 255, 255, 255);$ip = ( !empty($_SERVER['REMOTE_ADDR']) ) ? $_SERVER['REMOTE_ADDR'] : ( ( !empty($_ENV['REMOTE_ADDR']) ) ? $_ENV['REMOTE_ADDR'] : $REMOTE_ADDR );ImageString ($image, 10, 12, 50, "Your ip is $ip", $white);ImageString ($image, 10, 12, 80, "Your ip is ", $white);ImageString ($image, 10, 12, 100, "Your ip is $ip", $white);Imagepng($image);imagedestroy($image);?>It came out looking like this As you can see so far ive only been able to put the ip thing in. Each time i try to put something else in to it i get a blank screen.I wanted to add a random quote thing like tawxic's but each time i put in that code i keep getting a blank screen can sombody please help me?O and does anybody know the code that tells you your browser and OSSomething like this""you are running on windows xp and using IE 6.0"Thanks in advance Link to comment Share on other sites More sharing options...
gamehead200 Posted November 24, 2003 Share Posted November 24, 2003 OK, so for the random quotes, you would need a TXT file called "quotes.txt" with all the quotes on each line...Then you would create a JPG file with the following:<?phpHeader ('Content-type: image/jpeg');Header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');Header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');Header('Pragma: no-cache');// create the image$image = imagecreatefromjpeg("background.jpg");// set the colours$cool = imagecolorallocate($image, 81, 86, 96);$black = imagecolorallocate($image, 0, 0, 0);$white = imagecolorallocate($image, 255, 255, 255);$red = imagecolorallocate($image, 255, 0, 0);$grey = imagecolorallocate($image, 204, 204, 204);$green = imagecolorallocate($image, 206, 129, 18);$blue = imagecolorallocate($image, 0, 0, 255);// set quote file$quotes = file('quotes.txt');$quote = array_rand($quotes);// set the font and print text$font = '/path/to/your/ttf/font';$joke = wordwrap($quotes[$quote], 60, "\n", 1);$joke = explode("\n", $joke);for($i=0; $i<count($joke); $i++) { ImageTTFText ($image, 8, 0, 14, (23+($i*15)), $white, $font, $joke[$i]);}// output and destroyimagepng($image);imagedestroy($image);?>You would also need a background picture called "background.jpg" and the htaccess file mentioned in this topic... This code should be pretty simple to understand... I've tried including the OS and browser but it has never come out properly for me... I'll post it in here as soon as I find out... Link to comment Share on other sites More sharing options...
Recommended Posts