Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 

Sign in to follow this  
eXPerience-XP

IP Sig

Recommended Posts

Shotgun    0

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 cm

26-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)

Share this post


Link to post
Share on other sites
bman3022    0
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 98

But if anybody is interested heres how to show the browser name

Use $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 = "";

Share this post


Link to post
Share on other sites
Flynn    0
Now to find out how to rotate backgrounds... :rolleyes:

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]);

Share this post


Link to post
Share on other sites
renaxgade    0

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:

<?php
Header ('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 destroy
imagepng($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.

Share this post


Link to post
Share on other sites
bman3022    0

you need to replace the png things since your going to use a jpg file so try this:

<?php
Header ('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 destroy
imagejpg($image);
imagedestroy($image);

?>

This should work. Report back if it doesnt

Share this post


Link to post
Share on other sites
Datalore    0

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.

Share this post


Link to post
Share on other sites
Sunil    0

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.

Share this post


Link to post
Share on other sites
renaxgade    0

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 ?

Share this post


Link to post
Share on other sites
gamehead200    0
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... :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×