help me understand
Moderator: General Moderators
help me understand
i have a php image with random lines
http://sigs.hopto.org/sigs/mysig/sig51.php
this is an example of my problem..and it doesnt make sense
if you go to this image in internet explorer and keep refreshing it will show 4 different random lines and the time
all is good there...
in opera...
the random line doesnt work well (only shows 1 or 2) but the time changes fine.
somebody please help me understand this?
server side means it shouldnt matter what browser the user is using right?
i got a headache...
http://sigs.hopto.org/sigs/mysig/sig51.php
this is an example of my problem..and it doesnt make sense
if you go to this image in internet explorer and keep refreshing it will show 4 different random lines and the time
all is good there...
in opera...
the random line doesnt work well (only shows 1 or 2) but the time changes fine.
somebody please help me understand this?
server side means it shouldnt matter what browser the user is using right?
i got a headache...
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
sig51.php has this in it
thepic.php
Code: Select all
$addliner="1 random 1
2 random 2
3 random 3
4 random 4";
include_once("../thepic.php");Code: Select all
blah blah blah
$liner = split("\n", $addliner );
$p = intval(rand(0,(count($liner)-1)));
$addliner = $linerї$p];
blah blah blah
ImageTTFText ($image,20, 0, 10, 10, $color,$fontr,$addliner);Cant be a cache-control problem - even if you shift refresh, it has issues.
Plus, its a direct-output image - if you put headers on it, it messes up the output becuase its expecting an image only.
No, when I went, I noticed that the properties on the file gave an error, like it usually does when the graphic doesnt match the output type.
My bet is that he's taking a gif file, and outputting it as a PNG - causing a problem in the filters. IE accepts it, Moz and Opera don't (sorta).
Paste the image generation code, and we'll see whats going on.
(update)
You can see it directly in Moz, by right clicking, view property, and look at the alt tag.. it says something like..
"The image “file:sig51.png” cannot be displayed, because it contains errors"
Which generally means something in the script to generate the image messed up.
Plus, its a direct-output image - if you put headers on it, it messes up the output becuase its expecting an image only.
No, when I went, I noticed that the properties on the file gave an error, like it usually does when the graphic doesnt match the output type.
My bet is that he's taking a gif file, and outputting it as a PNG - causing a problem in the filters. IE accepts it, Moz and Opera don't (sorta).
Paste the image generation code, and we'll see whats going on.
(update)
You can see it directly in Moz, by right clicking, view property, and look at the alt tag.. it says something like..
"The image “file:sig51.png” cannot be displayed, because it contains errors"
Which generally means something in the script to generate the image messed up.
yyou migh have gotten those errors when i was trying to put in no-cache headers 
right, but i am using a png and just overlaying text
this is sig51.php
here is the code for thepic.php
I understand it's not great code but im just trying to get this to work before I make arrays and what not....
right, but i am using a png and just overlaying text
this is sig51.php
Code: Select all
<?
$addline1="";
$color1="000000255";
$size1="30";
$font1="arial.ttf";
$right1="100";
$down1="50";
$rotate1="-10";
$addline2="";
$color2="000000000";
$size2="10";
$font2="arial.ttf";
$right2="0";
$down2="10";
$rotate2="0";
$addliner="1 random 1
2 random 2
3 random 3
4 random 4";
$colorr="000000000";
$sizer="20";
$fontr="BNKGOTHL.TTF";
$rightr="20";
$downr="50";
$rotater="0";
$colort="000000000";
$sizet="20";
$fontt="arial.ttf";
$rightt="200";
$downt="50";
$rotatet="0";
$colorip="000000000";
$sizeip="10";
$fontip="arial.ttf";
$rightip="80";
$downip="0";
$rotateip="0";
$uname="24.218.231.121";
$back1="frame_orange.png";
include_once("../thepic.php");here is the code for thepic.php
Code: Select all
<? Header( "Content-type: image/png");
$time = strftime("%I:%M", time());
#$timearray = explode(':',$time);
$ip = getenv(REMOTE_ADDR);
$liner = split("\n", $addliner );
$p = intval(rand(0,(count($liner)-1)));
$addliner = $linerї$p];
$image = imagecreatefrompng('backs/'.$back1); /* Attempt to open */
$color1r = substr($color1,0,3);
$color1g = substr($color1,3,3);
$color1b = substr($color1,-3,3);
$color1 = ImageColorAllocate($image,$color1r,$color1g,$color1b);
$color2r = substr($color2,0,3);
$color2g = substr($color2,3,3);
$color2b = substr($color2,-3,3);
$color2 = ImageColorAllocate($image,$color2r,$color2g,$color2b);
$colortr = substr($colort,0,3);
$colortg = substr($colort,3,3);
$colortb = substr($colort,-3,3);
$colort = ImageColorAllocate($image,$colortr,$colortg,$colortb);
$colorrr = substr($colorr,0,3);
$colorrg = substr($colorr,3,3);
$colorrb = substr($colorr,-3,3);
$colorr = ImageColorAllocate($image,$colorrr,$colorrg,$colorrb);
$coloripr = substr($colorip,0,3);
$coloripg = substr($colorip,3,3);
$coloripb = substr($colorip,-3,3);
$colorip = ImageColorAllocate($image,$coloripr,$coloripg,$coloripb);
$black= ImageColorAllocate($image,0,0,0);
ImageTTFText ($image,$size1, $rotate1, $right1, $down1, $color1,'fonts/'.$font1,$addline1);
ImageTTFText ($image,$size2, $rotate2, $right2, $down2, $color2,'fonts/'.$font2,$addline2);
ImageTTFText ($image,$sizet, $rotatet, $rightt, $downt, $colort,'fonts/'.$fontt,$time);
ImageTTFText ($image,$sizer, $rotater, $rightr, $downr, $colorr,'fonts/'.$fontr,$addliner);
ImageTTFText ($image,$sizeip, $rotateip, $rightip, $downip, $colorip,'fonts/'.$fontip,$ip);
Imagepng($image);
ImageDestroy($image);
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
-
Illusionist
- Forum Regular
- Posts: 903
- Joined: Mon Jan 12, 2004 9:32 pm
i beleive mozilla puts that as an alt text on all straight image views incase it doesn't show... i tried it and every image has that same alt text.
the only thing I can possibly think of (and it may be way off the wall) is php randomizes the seed using something to do with the remote browser...nutty i know, but what else could it be?
the only thing I can possibly think of (and it may be way off the wall) is php randomizes the seed using something to do with the remote browser...nutty i know, but what else could it be?
i added
and now it works in ie and mozilla
I have the latest php....
I would of figured a bunch of smart people would be intrigued by this
problem.
Code: Select all
$liner = split("\n", $addliner );
shuffle($liner);
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$p = intval(rand(0,(count($liner)-1)));
$addliner = $linerї$p];I have the latest php....
I would of figured a bunch of smart people would be intrigued by this
problem.