ash992 Posted July 26, 2012 Share Posted July 26, 2012 Hey guys so I'm not sure what's wrong.. I'm trying to echo an image using some variables... simple stuff really but for some reason it's not working... This is the code in php, echo '<div align="left" class="advertpo"><img src="adverts/' . $UID. "/" . $UID . '.png"> </div>'; And here is what is showing when you view source, <div align="left" class="advertpo"><img src="adverts/1/1.png"> </div></td></tr> I call also press on the img link (adverts/1/1.png) And it shows me the image fine, but for some reason, when i load the page, It's not showing me the image? Anyone got any clue? Thank-you very much in advance guys! Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/ Share on other sites More sharing options...
NomadicJosh Posted July 26, 2012 Share Posted July 26, 2012 I would try a couple of things. One is set the absolute url for the image to see it is shows up and also set the image width and height. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364416 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Hmm, I've tried both of them, no luck with either :s Thank-you for the reply by the way, Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364421 Share on other sites More sharing options...
NomadicJosh Posted July 26, 2012 Share Posted July 26, 2012 Well, it was just a stab. Maybe paste more code to see what's going on; like where is $UID defined and how is it generated. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364425 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Ahah okay, well, UID is defined here, so it's just getting a variable from the database, I can echo it and it has the right value(1), So i don't know what the problem really is.. o.0 $UID = $b['UID']; Additional details: I recently moved servers and this exact script worked fine before the move? -Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364426 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Is it a thumbnail image ? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364427 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Not quite sure what you mean by that, but I don't think so.. It's just a normal .PNG image :s Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364428 Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 What does the HTML source show? Is the path and filename correctl? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364431 Share on other sites More sharing options...
NomadicJosh Posted July 26, 2012 Share Posted July 26, 2012 What happens if you change this "/" to this '/' Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364432 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 The source code shows </div> <div align="left" class="advertpo"><img height="90px" width="728" src="adverts/1/1.png"> </div></td></tr> and what it links to displays the image fine, and I shall try it now parkerj Thanks guys, Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364433 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 What does the HTML source show? Is the path and filename correctl? I was thinking the same like you, maybe he has a empty space. Try: $UID = urlencode($b['UID']); Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364434 Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 What does the HTML source show? Is the path and filename correctl? Nevermind. I missed it in the OP. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364435 Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 Is ti possible the div is hidden by CSS somehow? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364436 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 parkerj I'm afraid that didn't work, Nor did yours Jazzman, And i'll try it now pikachu, Thanks a lot guys! Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364437 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Nope, There's no css in that area, It's just outputting to a table, <tr><td colspan="2"> <div class="advertchangepo"><a href="engines/change.php"><div class="bigG"> Your advert [Change] </div></a> </div> <?php echo '<div align="left" class="advertpo"><img height="90px" width="728" src="adverts/' . $UID. '/' . $UID . '.png"> </div>'; ?> </td></tr> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364438 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Do you have a public link to this ? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364439 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 I'm afraid you need to log into the page to see it, you can see the image at http://adspring.co.uk/adverts/1/1.png Yet again though when i've tried to just <img src=""> That link with php there's still no output... And yet again this did all work before i switched servers.. So really not a clue what is wrong, :s Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364440 Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 What is in your stylesheet for 'advertpo'? Are you able to load the image in your browser by using http://www.yourdomain.com/adverts/1/1.png directly in the address bar? If not, it's probably a path issue. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364442 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Yep, http://adspring.co.uk/adverts/1/1.png loads fine, and in my stylesheet for .advertchangepo is just, .advertchangepo{ position:relative; top:- 20px; } Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364443 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Post the html code too. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364444 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 What Html code do you mean? Or are you talking about , <tr><td colspan="2"> <div class="advertchangepo"><a href="engines/change.php"><div class="bigG"> Your advert [Change] </div></a> </div> <?php echo '<div align="left" class="advertpo"><img height="90px" width="728" src="adverts/' . $UID. '/' . $UID . '.png" /> </div>'; ?> </td></tr> </table> </div> Thanks again guys Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364445 Share on other sites More sharing options...
Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 That isn't the class for the div the image is in, advertpo is. I'm leaning toward this being CSS/html related since the image is accessible and loads fine when called directly. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364447 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Ahh my apologies, And I've just realized that tag was empty.. The tag's been removed from the stylesheet + php code, <?php echo '<div align="left"><img height="90px" width="728" src="adverts/' . $UID. '/' . $UID . '.png" /> </div>'; ?> It's still not working though :/ Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364448 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Can you comment any css stylesheets and js files from the page, and try again ? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364450 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Nope, i'm afriad that's still not working, I've made a simpler version with no css or anything, http://adspring.co.uk/engines/Ads-dis.php Same problem... :l Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/#findComment-1364453 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.