Pikachu2000 Posted July 26, 2012 Share Posted July 26, 2012 Post the php code you used to generate that. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364457 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Everything is fine, I open it up, but you got a error message: The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must to be declared in the document or in the transfer protocol. http://adspring.co.uk/engines/Ads-dis.php Can you see the html structure ? Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364458 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 <?php include ("connect.php"); $query = "SELECT * FROM Users WHERE Type='AD'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $ADI = $row['UID']; echo '<a href="../adverts/' . $ADI . "/" . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png"></a>'; ?> simplified it even more... And I'm still getting no output, not sure why you're getting anything :s Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364459 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 When you open up your html source file do you see a properly html structure like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> CakePHP: the rapid development php framework: Messages </title> <link href="/cakephp/favicon.ico" type="image/x-icon" rel="icon" /><link href="/cakephp/favicon.ico" type="image/x-icon" rel="shortcut icon" /><link rel="stylesheet" type="text/css" href="/cakephp/css/cake.generic.css" /><script type="text/javascript" src="/cakephp/js/jquery-1.4.3.min.js"></script> <script type="text/javascript" src="/cakephp/js/form_validate.js"></script><script type="text/javascript"> //<![CDATA[ $(document).ready(function () {$("#submit-36739122").bind("click", function (event) {$.ajax({beforeSend:function (XMLHttpRequest) {$("div#sending").fadeIn();}, data:$("#submit-36739122").closest("form").serialize(), dataType:"html", success:function (data, textStatus) {$("div#sending").fadeOut();$("div#success").html(data);}, type:"post", url:"\/cakephp\/messages"}); return false;});}); //]]> </script></head> <body> <div id="container"> <div id="header"> <h1><a href="http://cakephp.org">CakePHP: the rapid development php framework</a></h1> </div> <div id="content"> <div id="success"></div> <div id="sending" style="display: none">Sending.....</div> <form action="/cakephp/messages" id="MessageIndexForm" method="post" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST" /></div> <fieldset> <legend>Ajax Request Form</legend> <div class="input text required"><label for="name">Name</label><input name="data[Message][name]" type="text" id="name" maxlength="30" /></div><div class="input text required"><label for="email">Email</label><input name="data[Message][email]" type="text" id="email" maxlength="30" /></div><div class="input textarea required"><label for="message">Message</label><textarea name="data[Message][message]" id="message" cols="30" rows="6" ></textarea></div><div class="submit"><input id="submit-36739122" type="submit" value="Send request" /></div></fieldset> </form> </div> <div id="footer"> <a href="http://www.cakephp.org/" target="_blank"><img src="/cakephp/img/cake.power.gif" alt="CakePHP: the rapid development php framework" border="0" /></a> </div> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364460 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Sorry about not replying to this, It was a bit too late and my internet cut out, However I've just found something quite handy with the problem, the same link seems to display in all the other browsers I've tried, apart from chrome? http://adspring.co.uk/engines/Ads-dis.php Here's the source code again, <?php include ("connect.php"); $query = "SELECT * FROM Users WHERE Type='AD'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $ADI = $row['UID']; echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364528 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 I told you, why ? You still got an error message. Your page does not have a proper html structure, something like this: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <htmlL> <head> <title>My first HTML document</title> </head> <body> <P>Hello world! </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364531 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Nope, I'm afraid not, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <htmlL> <head> <title>My first HTML document</title> </head> <body> <?php include ("connect.php"); $query = "SELECT * FROM Users WHERE Type='AD'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $ADI = $row['UID']; echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>'; ?> </body> </html> Still no chrome output Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364536 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 You probably use any php framework or CMS, right ? If you do, you have to include a default.ctp page (or something else ) rendering a proper html structure and encoding. Copy/paste this: <?php include ("connect.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> </head> <body> <?php $query = "SELECT * FROM Users WHERE Type='AD'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $ADI = $row['UID']; echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>'; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364540 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Nope I'm afraid it's still not working :/ Still working on all other browsers though.. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364541 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Ignore "include('connect.php')" and try this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Test</title> </head> <body> <?php $connect = mysql_connect('server','username','password'); mysql_select_db('database_name',$connect); $query = "SELECT * FROM Users WHERE Type='AD'"; $result = mysql_query($query) or die(mysql_error()); $row = mysql_fetch_array($result); $ADI = $row['UID']; echo '<a href="../adverts/' . $ADI . '/' . $ADI .'.php"><img src="../adverts/' . $ADI . '/' . $ADI . '.png" /></a>'; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364544 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Nope still nothing.. I've found something very interesting though, even if I remove all PHP... and just use <img src="../adverts/1/1.png" /> Then it still doesn't echo an image... But when you view source it still links to the right place? Not a clue what's happening.. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364556 Share on other sites More sharing options...
jazzman1 Posted July 26, 2012 Share Posted July 26, 2012 Attach your script file here. I want to check something.. Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364558 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 I've found the problem... http://adspring.co.uk/engines/Ads-dis.php Is displaying for me now, The problem was because of the image size my google adblock was registering it as an advertisement, and making it not display... Totally forgot all about adblock. Thanks for all of your help guys... Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364565 Share on other sites More sharing options...
ash992 Posted July 26, 2012 Author Share Posted July 26, 2012 Sorry for wasting your time here guys... Quote Link to comment https://forums.phpfreaks.com/topic/266254-not-outputting-image/page/2/#findComment-1364566 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.