tinker Posted February 26, 2008 Share Posted February 26, 2008 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) Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 * BUMP * Quote Link to comment Share on other sites More sharing options...
trq Posted February 28, 2008 Share Posted February 28, 2008 Pretty hard to make a guess, you might want to actually post the relevent code! Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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? Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 28, 2008 Share Posted February 28, 2008 ARGH, that html makes my eyes bleed. :'( So tell me, if you go to http://www.rawstar7.co.uk/cmstmp/cmsmonkey.0.1.8/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg Does it load your image? Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 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. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 28, 2008 Share Posted February 28, 2008 That image didn't even exist... are you 100% sure your image(s) are on the server? Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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)... Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 Can you show us what you get when you echo $sret? Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 For live it's: <img src='/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' alt='rawstar7_01_06a_02.jpg'> or if it was absolute: <img src='http://www.rawstar7.co.uk/monkey/mods/adverts/ads/rawstar7_01_06a_02.jpg' alt='rawstar7_01_06a_02.jpg'> Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 I don't want to see what it should be (you already showed us that), I want to see what it IS! Echo $sret, copy the output, and paste it here as is. Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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 Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 Since I cant see your local links, can you post the echo of $sret from the live site? No worries on the help, although I havent actually helped yet! Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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!) Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 I didn't realize that was the very first line of code. That is most likely your problem - you need to move that image tag into the body. Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 No, it's only first when it's echoed. (the CMS might not quite be what you'd call a framework, it doesn't echo as it goes, just dumps all at end (because of a caching feature (which is rarely used anyway))) Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 I see what you are saying. Ok, it looks like the link is fine - but where is that link in your actual site? Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 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! Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 Right, I told you it'd be me being daft... the module 'Adblock Plus' is enabled on firefox! Right i'll have to do some test's but I think a little re-naming will get past that thing! But hey, it's good to know! Cheers for time and help! Quote Link to comment Share on other sites More sharing options...
haku Posted February 28, 2008 Share Posted February 28, 2008 Haha! I'm using adblock too, which is why I couldn't see it either! I should have realized that. Its good to know for the future though. I'll have to check on other browsers. Quote Link to comment Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 I've just realised, there's no solved feature no more! The amount of other sites i've referred about this feature... Just been looking through my thesaurus to see what to rename the advert module to, and here is the word of the day: promulgation! Quote Link to comment Share on other sites More sharing options...
tinker Posted February 29, 2008 Author Share Posted February 29, 2008 For those who are interested, it was a regular experience to read through the files in '/home/user/.mozilla/firefox/es2x2t5y.default/adblockplus'. P.S. We use this product for a reason though, so don't totally abuse it! (also see privoxy) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.