tawxic Posted December 12, 2003 Posted December 12, 2003 eh - anyone know why it's tellin me:[Fri Dec 12 04:11:40 2003] [error] [client 68.116.78.89] Premature end of script headers: /home/phazm/public_html/sig/siggy.jpgI just got a new host.. they have the latest version of PHP
tawxic Posted December 12, 2003 Posted December 12, 2003 oi, here's my code:<?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');$textfile ="quotes.txt"; // change to the filename/path of your file with quotes.$quotes = file("$textfile");$quote = rand(0, sizeof($quotes)-1);$getquote = wordwrap($quotes[$quote], 55, "\n", 1);$ipad = getenv("REMOTE_ADDR");$dns = strtolower(@gethostbyaddr(getenv("REMOTE_ADDR")));$today = date("m-d-Y");// 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);$info = "$today - You are $dns ($ipad)";$counter = "$views people informed - © 2003 Phazm Graphics - http://www.phazm.net/";// define geek code$nerd = $getquote;// line style line$line = "___________________________________________________________";// set the font and print text$font = 'verdana.ttf';ImageTTFText ($image, 10, 0, 45, 35, $white, $font, $nerd);ImageTTFText ($image, 8, 0, 27, 126, $white, $font, $info);ImageTTFText ($image, 8, 0, 27, 130, $white, $font, $line);ImageTTFText ($image, 8, 0, 27, 143, $white, $font, $counter);// output and destroyimagepng($image);imagedestroy($image);?>
Vega Posted December 12, 2003 Posted December 12, 2003 Is this sopposed to be like, in php or something? I have never programmed in php but I have thought about it. If it is, can someone give me resources where I could learn to program in php and get a compiler (if one is required)?
tawxic Posted December 21, 2003 Posted December 21, 2003 What's the code for makign a random IMAGE (not background) - I want to be able to position it, also.
bman3022 Posted December 21, 2003 Posted December 21, 2003 I found this script :<?php/* Name your images 1.jpg, 2.jpg etc. Add this line to your page where you want the images to appear: <?php include "randomimage.php"; ?>*/ // Change this to the total number of images in the folder$total = "11";// Change to the type of files to use eg. .jpg or .gif$file_type = ".jpg";// Change to the location of the folder containing the images$image_folder = "images/random";// You do not need to edit below this line$start = "1";$random = mt_rand($start, $total);$image_name = $random . $file_type;echo "<img src=\"$image_folder/$image_name\" alt=\"$image_name\" />";?>I got it from here: http://www.devscripts.com/visit.php?sId=3424Try working with it in the script it might work.
tawxic Posted December 21, 2003 Posted December 21, 2003 well, here is the other one I'm working on:And I want to make a random image in the right side of it, cuz it's blank..I Could just make the background have that image in it, but that would be tedious... actually... I think I will do that.. lol Thanks!
Tinker Posted December 21, 2003 Posted December 21, 2003 Well MERRY X-MAS..............Looks like the 500x100 80k sig rule is no longer in effect. The sigs just keep getting bigger and bigger. I can not believe that the folks that have over sized sigs do not know that they are breaking the rules. The sig rule is at the top of this thread for all to read. So let me be the first to say, "Have a Big Sig day"...
tazz Posted January 6, 2004 Posted January 6, 2004 I've been playing with this the whole day and couldn't get it to work. First I got errors and garbles and now I only get a red x.Does anybody have the source files (ones that work) I could play with?
hwa Posted January 6, 2004 Posted January 6, 2004 The only thing I'm having trouble with is the actual text showing up. :/ When I direct my browser to siggy.jpg the blank-bg.gif is what comes up as siggy.jpg, the views.txt is also being updated so the php must be executing.I've checked and double checked the path to the TTF file. Is there something else that I'm missing that could be causing the image to be generated without any text?siggy.jpgI added the .htaccess like I should have (obviously since the code executes) and even went so far as to put full paths in to all the files called out. Anybody have any idea as to what could be going wrong?
jmoore Posted January 7, 2004 Posted January 7, 2004 HWA, try this:<?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');// change to the filename/path of your file with quotes.$textfile ="http://www.advancedstrikeforce.com/hwa/quotes.txt";$quotes = file("$textfile");$quote = rand(0, sizeof($quotes)-1);$getquote = wordwrap($quotes[$quote], 55, "\n", 1);// get ip, host info and date$ip = $_SERVER['REMOTE_ADDR'];$fullhost = gethostbyaddr($ip);$host = preg_replace("/^[^.]+./", "", $fullhost);$today = date("m-d-Y");// create the image$image = imagecreatefromgif("http://www.advancedstrikeforce.com/hwa/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$vfile = "views.txt"; // chmod 777$viewss = file("$vfile"); $views = $viewss[0]; $views++;$fp = fopen("$vfile", "w");fwrite($fp, $views);fclose($fp);$info = "$today - You are $host ($ip)";$counter = "$views people informed - © 2003 Phazm Graphics - http://www.phazm.net/";// define geek code$nerd = $getquote;// line style line$line = "___________________________________________________________";// set the font and print text GD automatically parses ttf files$font = 'verdana';ImageTTFText ($image, 10, 0, 45, 35, $black, $font, $nerd);ImageTTFText ($image, 8, 0, 27, 126, $black, $font, $info);ImageTTFText ($image, 8, 0, 27, 130, $black, $font, $line);ImageTTFText ($image, 8, 0, 27, 143, $black, $font, $counter);// output and destroyimagepng($image);imagedestroy($image);?>You can see it here: http://www.wvghosts.com/test/t2.php
hwa Posted January 7, 2004 Posted January 7, 2004 I figured out what the problem was ... I changed the TTF info | removed the path and capatalized VERDANA.TTF and it worked.The 1 issue that I have now is that when I save it as siggy.jpg a lot of people can't see it. (I can see it fine) -- but the same people who couldn't display mine couldn't display other sigs on this board.To fix the issue I renamed the file to siggy.png and changed the .htaccess to reflect the same, then everyone could see it.Could that problem be with local side browser settings? Just curious since it appears that their browsers were having a problem displaying a .png file as an actual .jpg when it wasn't. My firebird and IE6 both displayed it properly though.
ml20 Posted January 8, 2004 Posted January 8, 2004 <?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');// change to the filename/path of your file with quotes.$textfile ="quotes.txt";$quotes = file("$textfile");$quote = rand(0, sizeof($quotes)-1);$getquote = wordwrap($quotes[$quote], 55, "\n", 1);// get ip, host info and date$ip = $_SERVER['REMOTE_ADDR'];$fullhost = gethostbyaddr($ip);$host = preg_replace("/^[^.]+./", "", $fullhost);$today = date("m-d-Y");// create the image$image = imagecreatefromjpeg("background.jpg");// 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$vfile = "views.txt"; // chmod 777$viewss = file("$vfile"); $views = $viewss[0]; $views++;$fp = fopen("$vfile", "w");fwrite($fp, $views);fclose($fp);$info = "$today - You are $host ($ip)";$counter = "$views people informed/";// line style line$line = "___________________________________________________________";// set the font and print text GD automatically parses ttf files$font = 'verdana.ttf';ImageTTFText ($image, 8, 0, 27, 126, $red, $font, $info);ImageTTFText ($image, 8, 0, 27, 130, $black, $font, $line);ImageTTFText ($image, 8, 0, 27, 143, $black, $font, $counter);// output and destroyimagepng($image);imagedestroy($image);?>Is there something wrong here, because I am getting a red X and not an image
bman3022 Posted January 9, 2004 Posted January 9, 2004 chage this:imagepng($image);imagedestroy($image);to this:imagejpg($image);imagedestroy($image);Did you save it as a .jpg?
ml20 Posted January 10, 2004 Posted January 10, 2004 yes, and when I tried to change imagepng($image), it gave me a php error. should I save my pic as a png in that case?
Recommended Posts