Shotgun Posted December 3, 2003 Share Posted December 3, 2003 Just found this on php.net under the imagecreatefromgif entry: imagecreatefromgif() returns an empty string on failure. It also outputs an error message, which unfortunately displays as a broken link in a browser.also:dpetrov at nchcapital dot cm26-Aug-1999 01:37 Support for PNG images was added to GD with the removal of GIF support. Latest patches for PHP 3.0 add new functions, in particular ImageCreateFromPng() and ImagePng(). At the time of writing, for some odd reason, PHP 4.0 does NOT have these functions.check the PHP version on the server the script is running from. check there for a function to output an error message in case the imagecreate functions bails out with an error.Can you read a GIF to output a PNG? I've only done reading from the same type as the output (read GIF->Output GIF, read JPG -> Output JPG, and so on) Link to comment Share on other sites More sharing options...
bman3022 Posted December 4, 2003 Share Posted December 4, 2003 Report back if this works as I have never had a ME machine and the other person had yet to report back if the patch worked.nope it didnt work it still says windows 98But if anybody is interested heres how to show the browser nameUse $browser to call it //browser type $agent = $HTTP_USER_AGENT; if ( strstr($agent, "MSIE 5") ) $browser = "using IE 5"; elseif ( strstr($agent, "MSIE 6") ) $browser = "using IE 6"; elseif ( strstr($agent, "MSIE 4") ) $browser = "using IE 4"; elseif ( strstr($agent, "Firebird") ) $browser = "using Firebird"; elseif ( strstr($agent, "Safari") ) $browser = "using Safari"; elseif ( strstr($agent, "Mozilla/5") ) $browser = "using Mozilla/Netscape 5"; elseif ( strstr($agent, "Mozilla/6") ) $browser = "using Netscape 6"; elseif ( strstr($agent, "Mozilla/4") ) $browser = "using Netscape 4"; elseif ( strstr($agent, "Opera") ) $browser = "using Opera"; else $browser = ""; Link to comment Share on other sites More sharing options...
gamehead200 Posted December 4, 2003 Share Posted December 4, 2003 Sweet! Now we can make our own IP sigs! Now to find out how to rotate backgrounds... Link to comment Share on other sites More sharing options...
Flynn Posted December 4, 2003 Share Posted December 4, 2003 Now to find out how to rotate backgrounds... This snippent of code will rotate (random) backgrounds Of course you need to change it around a bit to match your script (image type and names) maybe, notice the first variable in the array is left blank "", I did this just to make the image numbers match the array number without using 0 as an image number.You also need to change your "createfrom" line to include the new random variable. The only problem with this is that the browser doesn't refresh all the time because the linked image name remains the same, depending on your browser settings of course. // random background$random_image = array("", "bg1.png", "bg2.png", "bg3.png", "bg4.png");srand ((double) microtime() * 1000000);$rnd = rand(1,4);// create the image$image = imagecreatefrompng($random_image[$rnd]); Link to comment Share on other sites More sharing options...
renaxgade Posted December 8, 2003 Share Posted December 8, 2003 Ok, well I'm trying to follow all of this. I have a file called .htaccess and it looks like this<Files ipaddress.jpg>ForceType application/x-httpd-php</Files>I also have a file called ipaddress.jpg that looks like 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');// create the image$image = imagecreatefrompng("bg.png");// 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 the font and print text$font = 'Arial.ttf'ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);// output and destroyimagepng($image);imagedestroy($image);?>When I open the jpg through a php enabled browser, it just gives me the code back for ipaddress. No image just code. The bg.png is also in that folder. BTW: I am using a Windows Apache server with php, and in my php info I can't find anything with "GD" in it, I searched. Link to comment Share on other sites More sharing options...
bman3022 Posted December 9, 2003 Share Posted December 9, 2003 you need to replace the png things since your going to use a jpg file so try this:<?phpHeader ('Content-type: image/jpg');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 = imagecreatefrompng("bg.png");// 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 the font and print text$font = 'Arial.ttf'ImageTTFText ($image, 8, 0, 10, 17, $white, $font, "Your IP Address is... ".$REMOTE_ADDR);// output and destroyimagejpg($image);imagedestroy($image);?>This should work. Report back if it doesnt Link to comment Share on other sites More sharing options...
gamehead200 Posted December 9, 2003 Share Posted December 9, 2003 Anyone know how to center text on a PHP sig? Link to comment Share on other sites More sharing options...
Datalore Posted December 9, 2003 Share Posted December 9, 2003 Anyone know how to stream a movie file into a sig? It should be possible. Just tell the player application to output the move to a 30 frame animated gif every second. Whoosh, 100 kb streaming gif movie player. I have no idea what I'm talking about. Link to comment Share on other sites More sharing options...
bman3022 Posted December 10, 2003 Share Posted December 10, 2003 I dont think thats possible using this script Its easier just to make a gif out of the clip using an animator Link to comment Share on other sites More sharing options...
Sunil Posted December 10, 2003 Share Posted December 10, 2003 I think to achive this you would need to create a script that would automatically create the SIG from the new image output. This could be done by simply deleting the old one and renaming the new one the same as the old, but to create the stream, i donno. Link to comment Share on other sites More sharing options...
Datalore Posted December 10, 2003 Share Posted December 10, 2003 It would be pretty cool to have entire movies playing in your sig, movies that normally couldn't be turned into a regular gif. Link to comment Share on other sites More sharing options...
renaxgade Posted December 11, 2003 Share Posted December 11, 2003 I'm not sure if my php is configured correctly. Can someone check ifhttp://renaxgade.net/test.phpis enabled for these kind of sigs? Link to comment Share on other sites More sharing options...
bman3022 Posted December 11, 2003 Share Posted December 11, 2003 yes GD is enabled on there so the sig should work Link to comment Share on other sites More sharing options...
renaxgade Posted December 11, 2003 Share Posted December 11, 2003 Hrmm, it doesn't seem to be working. The sig just displays me code of php, so I don't think that the .htaccess is working. The weird thing is, it doesn't look like it's in the directory, but If i type it in from command line it works. Do I have to tell my http.conf to look for .htaccess ? Link to comment Share on other sites More sharing options...
gamehead200 Posted December 11, 2003 Share Posted December 11, 2003 Hrmm, it doesn't seem to be working. The sig just displays me code of php, so I don't think that the .htaccess is working. The weird thing is, it doesn't look like it's in the directory, but If i type it in from command line it works. Do I have to tell my http.conf to look for .htaccess ?Yes... I think there's an option for it in the httpd.conf file... Link to comment Share on other sites More sharing options...
Recommended Posts