Forum Moderators: coopster

Message Too Old, No Replies

PHP img Problem with IE7

There must be something wrong with my code?

         

camaroboy

5:14 am on Oct 11, 2007 (gmt 0)

10+ Year Member



I have some PHP script to display an image. I have tried to view this page (with the image) on 3 different computers all using IE7, and it worked on 2 of the 3. I cant seem to figure out why the image will not show up on one of the computers?

The PHP script is as follows:

<img src='".$mosConfig_live_site."/images/$option/ads/".$row->id.$ext_name."_t.jpg' alt='".htmlentities(stripslashes($row->ad_headline),ENT_QUOTES)."' border='0' />

On the 2 computers where it works when I view the source I get:

<img src='http://www.example.com/images/com_adsmanager/ads/1a_t.jpg' alt='' border='0' />

On the computer where it doesnt work I get:

<!-- -->

Any ideas?

[edited by: eelixduppy at 5:15 am (utc) on Oct. 11, 2007]

Habtom

5:17 am on Oct 11, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you printing anything?

Perhaps something like the following:

echo "<img src='".$mosConfig_live_site."/images/$option/ads/".$row->id.$ext_name."_t.jpg' alt='".htmlentities(stripslashes($row->ad_headline),ENT_QUOTES)."' border='0' />";

Added

On the computer where it doesnt work I get:

<!-- -->

It seems you have got the wrong lines, the result you mentioned couldn't probably come out of the original line you mentioned above.

[edited by: Habtom at 5:19 am (utc) on Oct. 11, 2007]

camaroboy

6:06 am on Oct 11, 2007 (gmt 0)

10+ Year Member



No I'm not printing anything. The entire PHP command for the code (instead of just the image portion that isnt working) is:

<?php
$linkTarget = sefRelToAbs("index.php?option=com_adsmanager&amp;page=show_ad&amp;adid=".$row->id."&amp;catid=".$row->category."&amp;Itemid=".$itemid);
$ok = 0;$i=1;
while(!$ok)
{
if ($i < $nb_images + 1)
{
$ext_name = chr(ord('a')+$i-1);
$pic = $mosConfig_absolute_path."/images/$option/ads/".$row->id.$ext_name."_t.jpg";
if (file_exists( $pic))
{
echo "<div align='center'><a href='".$linkTarget."'><img src='".$mosConfig_live_site."/images/$option/ads/".$row->id.$ext_name."_t.jpg' alt='".htmlentities(stripslashes($row->ad_headline),ENT_QUOTES)."' border='0' /></a>";
$ok = 1;
}
}
else if ($nb_images!= 0)
{
echo "<div align='center'><a href='".$linkTarget."'><img src='".$mosConfig_live_site."/components/$option/images/nopic.gif' alt='nopic' border='0' /></a>";
$ok = 1;
}
else
{
$ok = 1;
}
$i++;
}

echo "<br /><a href='$linkTarget'>".stripslashes($row->ad_headline)."</a>";
echo "<br /><span class=\"adsmanager_cat\">(".$row->parent." / ".$row->cat.")</span>";
echo "<br />".adsmanager_html::reorderDate($row->date_created);
echo "</div>";
?>

But like I said before, only the "if" statement image part isnt working.

adb64

8:16 am on Oct 11, 2007 (gmt 0)

10+ Year Member



On the computers on which it doesn't work, is there some ad-blocking software installed? The source line you show has the word 'ads' in it. This may trigger an ad blocker which replaces the line by an HTML comment line.

camaroboy

4:10 pm on Oct 11, 2007 (gmt 0)

10+ Year Member



Thanks for the response adb64! I actually think it has something to do with the system as well and not that the php is wrong. To my knowledge the computer does not have an ad blocker. The website this php goes on does have adsense and they are displaying fine. Like I said, it is strange that its working on 2 of the 3 computers, all running IE7, Google toolbar, McAfee...basically the same set-up.

The script says "ads" but it is really for a classifieds section of the website so maybe my next step should be changing the word "ads" in the script to "classifieds" instead and seeing if that fixes it?