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) Link to comment https://forums.phpfreaks.com/topic/93164-image-path/ Share on other sites More sharing options...
tinker Posted February 28, 2008 Author Share Posted February 28, 2008 * BUMP * Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479041 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! Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479042 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? Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479047 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479066 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479079 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? Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479084 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479091 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? Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479103 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)... Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479115 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? Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479126 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'> Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479128 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479134 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 Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479142 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! Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479157 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!) Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479173 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479185 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))) Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479192 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? Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479200 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! Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479210 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! Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479229 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. Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479242 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! Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479284 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) Link to comment https://forums.phpfreaks.com/topic/93164-image-path/#findComment-479864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.