Jump to content

image path


tinker

Recommended Posts

Hi,

Using PHP i'm generating a path for an advert, however for some reason it's just stopped showing the image. I can add text around where the image is supposed to be and it shows, but no image and no alt shows either. I've looked in the page source and the path is correct, I can even copy this, put it in the browser and it shows. I've checked all the mod_rewrite stuff and nothing should be interfering. I'm at a loss, anyone got any ideas?

 

P.S. The directory properties seem ok (even tried all variations)

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/
Share on other sites

OK, this is from a local version, but it is available online at http://www.rawstar7.co.uk (adverts should be on most page's, but you'll have to look in the source, search for 'ad'

 

Here's the code for the generation:

function adverts_gen_local($size)
{
global $prefix, $dir_cms, $dir_mods;
global $site_data;

$sret = "";
$dir = $dir_cms.$dir_mods."adverts"._SEP."ads"._SEP;
$lret = dir_list2($dir);

$ilen = count($lret);
if ($ilen >= 1)
{
	srand( (double) microtime() * 1000000 );
	$n = rand( 0, $ilen - 1 );
	$sret .= "<img src='"._SEP.$site_data['dir_path'].$dir.$lret[$n][0]."' alt='".$lret[$n][0]."'>";
}
return $sret;
}

 

And this is what it looks like within a generated page:

<table width='100%'>
<tr>
	<td><img src='/cmstmp/cmsmonkey.0.1.8/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' alt='rawstar7_01_06a_02.jpg'></td>
</tr>
</table>
</td></tr><tr><td colspan='3' valign='top' align='center'>

 

I've used relative and absolute paths, however if I src into the main resources directory then it works, so i'm thinking it could be a directory problem but i've checked all the permissions and there currently the same as the src directory.

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479079
Share on other sites

Nope. I tried that too.

 

I couldn't find the code for that image anywhere on the pages I tried. Are you sure that you are you sure that that image tag is even outputting to the browser? It doesn't appear to be.

 

One thing you may want to try is taking away the leading slash from your path to the image - it can screw things up.

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479091
Share on other sites

Right, sorry the cms was updated yesterday and the adverts module wasn't installed. Also that link you tried is using part of the offline path, this is the online variation 'http://www.rawstar7.co.uk/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' (rawstar7_01_04a_02.jpg, rawstar7_01_06a_02.jpg, rawstar7_01_07a_01.jpg).

 

Absolute paths have been tried (local and live (but not currently on live)):

$sret .= "<img src='".$site_data['site_addr']._SEP.$site_data['dir_path'].$dir.$lret[$n][0]."' alt='".$lret[$n][0]."'>";

 

 

Oh you can actually search for 'adverts' (I never came back after checking)...

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479115
Share on other sites

It is!

Here's what it looks like on the local (from src because it's not showing the image or alt):

<img src='/cmstmp/cmsmonkey.0.1.8/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' alt='rawstar7_01_06a_02.jpg'><br>

 

Once it's generated, it's basically echoed out, and that last first example was taken directly from the outputted source of the host version.

 

P.S. Cheers for the assitance

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479142
Share on other sites

If you look in the source, this is currently the first line:

<img src='http://www.rawstar7.co.uk/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' alt='rawstar7_01_06a_02.jpg'>

and if I put that on it's own into my browser, it displays the image? (it's not making sense to me? very bemused? obviously i'm gonna look daft after the solution is found, but... i'll pretend Gibbs will give me a slap on the back of the head!)

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479173
Share on other sites

In the source search for 'adverts' and you'll be taken straight to it.

 

A strange thing, i've just opened opera for another test and the img was at the top of the page and in it's advert place. Now, i'm not sure what this means but... ergh?

 

What browser are you using? (I'm generally using firefox 2.0.0.10)

 

All my images are re-saved through GIMP (used to re-comment), so they should all be the same, but it's something to check... It's plain madness, but it'll explain why no 'alt' is being shown, if it simply just can't display the image!

Link to comment
https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479210
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.