Problem with cross browser issue & PHP

The place to post if you need help or advice

Moderators: ChriThor, LXF moderators

Problem with cross browser issue & PHP

Postby photobod » Thu Jul 28, 2005 9:04 am

I'm nearing the end of developing a new website which uses PHP/MySQL to handle user sessions and generate image galleries on the fly for voting purposes.

While everything works fine in Moz/FF/Konq, there are a couple of issues with IE (no kidding!) and Opera which I'm having problems sorting out.
First, the site is frame-based and although Moz/FF/Konq/IE don't show the frame borders 'cause I've made them zero, Opera does show thin grey outlines on all frames. IE shows some white lines, but not on all frames.

Second, and much more important, although all browsers show the gallery contents when the user is not logged in, as soon as the user logs in, IE/Opera no longer generate the thumbnails.

To ensure that only logged in users can vote, the thumbnail script detects whether the user is logged in and generates the links only if they are. The links include GET data, passed to the voting script

I think I've tied the problem down to a specific line of code, but I can't actually see anything wrong with it. Remember, it works fine in proper browsers!

NOTES on the code snippet:
1) function clickable returns true if the user is logged in.
2) $gallery is the URL of the gallery folder in use and is set from GET data passed to the script.

if (clickable())
echo "<b>Click any image to vote.<br>" . "You may vote only once for any individual entrant.<b>";
echo "<b>You are welcome to browse, but you must be registered and signed in to vote.<b>";
// build page as table of four columns, each 125px wide
$pix = array();
$dh = opendir($gallery);
while (false !== ($filename = readdir($dh)))
$pix[] = $filename;
$column = 0;
echo "<table align=\"center\">";
foreach ($pix as $pic)
if (($pic==".") || ($pic==".."))
// Set up the full path to the picture
$picUrl=$gallery . "/" . $pic;
// Get the width and height of the image
$size = getimagesize("$picUrl");
if ($size[0] > $size[1])
$scale = $size[0] / 125;
$scale = $size[1] / 125;
// Now set the size of the image
$width = $size[0] / $scale;
$height = $size[1] / $scale;
// Start a new row if necessary
if ($column == 0)
echo "<TR>";
// Create a new item
echo "<td align=\"center\" valign=\"middle\">";
// Add a hyperlink if the user is logged in
if (clickable())
$linkto = "vote.php?votefor=" . $pic . "&page=" . $page . "&picUrl=" . $picUrl;

// Up to this point, everything works in IE/Opera.
// If the variable $linkto is simply echoed to the page, they render
// a table of link addresses with appended GET data.

echo "<a href=\" $linkto \"";
// Add the image
echo "<img width=$width height=$height src=\"" . $picUrl . "\" >";
// End the hyperlink if the user is logged in
if (clickable())
echo "</a>";
// Complete the item
echo "</TD> \n";
if ($column == 4)
echo "</TR> \n";
$column = 0;
Posts: 94
Joined: Thu Apr 21, 2005 7:18 pm
Location: London

Return to Help!

Who is online

Users browsing this forum: No registered users and 0 guests