View Full Version : [php sig qustion]
I had a php file written to put a random sig on the forum when you refresh the page. but I uploaded an old version to my server and lost some of the code by mistake.
I fixed it to work in a browser and on my forum but it doesn't work on BUF still because this forum will only read binary info when it looks for an sig image.
My script sends the image tag instead.
Can anyone with php knowledge help me out?
I need some script that will send the image binary info instead of the link to the image.
here is what i have so far.
<?php
$total = "8";
$file_type = ".jpg";
$image_folder = "sigs";
$start = "1";
$random = mt_rand($start, $total);
$image_name = $random . $file_type;
echo "<img src=\"http://www.merypoppinspandaclan.com/$image_folder/$image_name\" alt=\"$image_name\" />";
?>
iridium
1st Aug 2005, 07:06 PM
The problem is that you have no way of putting HTML into your sig from another webpage. If you did, then you could put javascript alerts and all sorts of other crap in there.
If you want to have a random sig image script, you must return image data.
you should replace that echo statement with
echo file_get_contents( "$image_folder/$image_name" );
and also put in a
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($name));
in there too (Before the echo)
Awww . . . . it is still missing something.
*fyi:
and also put in a
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($name));
in there too (Before the echo)
Headers are not realy needed , php will create them automaticly.
iridium
2nd Aug 2005, 01:26 PM
No, it won't. Internet Explorer may do some automatic detection of the mime type and therefore work, but your creation may be broken with other browsers (Firefox) if you serve binary content and do not mark it as such.
[edit] Also, Awww . . . . it is still missing something. Care to elaborate?
Crowze
2nd Aug 2005, 02:32 PM
You could just redirect it to the image, usingheader("Location: $image");Mine uses this, works fine.
Zxanphorian
2nd Aug 2005, 03:11 PM
Iri, I know I am the greatest! ;)
BAH :lol:
you congradulate yourself to much. I got my random sig working agian, but I can't take all the credit myself. One of my roomates helped me out. We looked at some of the code people here are useing here to do the random sig. It was not very nice looking at all. Some of them we are suprised even worked for them.
You could just redirect it to the image, usingheader("Location: $image");Mine uses this, works fine.
is that why your sig never changes?
Ah well ,
If some one is still interested i can post the code.
Thank you guys for your help.
iridium
2nd Aug 2005, 06:40 PM
is that why your sig never changes?
Yup, some browsers will interpret the "Location:" as a "This file has moved to 'Location:', don't come back to get a new one". You can tell browsers not to do this through some other headers though.
vBulletin® v3.8.0 Release Candidate 2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.