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
Share on other sites

Well I didn't because the html outputted is right and the link when tested on own works, nothing seems relevant in htaccess, so I don't really know what to show you? (I even hard-coded the outputted link). I'll have another look, but what would you like to see?

Link to comment
Share on other sites

Your code. Do you want us to guess what is wrong or something? You say your code isn't wrong, but obviously it is, or you wouldn't be having this.

 

Either that or the image isn't saved on your server. While you're at it, give us a link to the page as well.

Link to comment
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
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
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
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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.