dkperez Posted March 30, 2010 Share Posted March 30, 2010 I want to display a local image from a browser. Without wasting the time on a urination festival about "why do I want to display a local file" or "why not download it from the server", trust me that I want to display a local image..... php sets everything up, so I have the full path and all for the image. In the form I have: <a><img src="c:/xampp/htdocs/images/xxx.jpg" alt="NO IMAGE AVAILABLE"></a> and all I get is "NO IMAGE AVAILABLE". I rummaged around, and found that wiki insists that the correct syntax is: <a><img src="file:///c:/xampp/htdocs/images/xxx.jpg" alt="NO IMAGE AVAILABLE"></a> but I get the same "NO IMAGE AVAILABLE"...... So, from a plain old, regular html file that has a form in it, HOW do I display this image? Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/ Share on other sites More sharing options...
shlumph Posted March 30, 2010 Share Posted March 30, 2010 You need to make an image handler, and make use of file_get_contents. I wrote a blog that might help, it's kinda the same idea, but you don't need to resize anything: http://www.robkeplin.com/blog/?p=85 Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034233 Share on other sites More sharing options...
arbitter Posted March 30, 2010 Share Posted March 30, 2010 http://localhost/images/xxx.jpg Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034256 Share on other sites More sharing options...
ignace Posted March 30, 2010 Share Posted March 30, 2010 That's because Windows uses \ not / file:///c:\xampp\htdocs\images\xxx.jpg Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034306 Share on other sites More sharing options...
Zane Posted March 30, 2010 Share Posted March 30, 2010 try this Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034330 Share on other sites More sharing options...
haku Posted March 31, 2010 Share Posted March 31, 2010 Are the site files on your local computer, or on a server? Or on a server on your local computer (localhost)? Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034447 Share on other sites More sharing options...
dkperez Posted March 31, 2010 Author Share Posted March 31, 2010 I've already done all the stuff in the replies...... I don't get an image..... The full-sized images to be displayed are located in a folder on the LOCAL system. The browser is running from the web server, and all the necessary full path and file information is available there.... BUT, to simplify things, here's a simplified version of my html that (AS NEAR AS I CAN TELL) should display an image..... It DOESN'T....... I need someone to tell me what's wrong with the syntax: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> </head> <body> <div> <form> <a><img src="file:///d:/dew.jpg" alt="NO IMAGE AVAILABLE"></a> </form> </div> </body> </html> I've even attached a much smaller, low quality version of the dew.jpg file....... What have I got wrong in here? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034734 Share on other sites More sharing options...
haku Posted March 31, 2010 Share Posted March 31, 2010 It can't be done if the file and image aren't on the same system. Any path you put into the html will be searched for on the same system where the html file lies. Since the image is local, it won't find it. Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034743 Share on other sites More sharing options...
arbitter Posted March 31, 2010 Share Posted March 31, 2010 So you are running a site that is online, and an image that is on your computer? Or am I interpreting this wrong? Any file seen on a webpage must be on the internet too. Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1034834 Share on other sites More sharing options...
dkperez Posted April 3, 2010 Author Share Posted April 3, 2010 OK, I"ve either made this EASIER or a LOT HARDER...... I found out last night that the facility where the meeting is held, and where the slideshow needs to be shown HAS NO WI-FI........ So, there's no Internet connection that'll do me any good....... SO, I"m going to have to rethink this whole mess... Probably just run the browser locally, and do something with a php slideshow..... Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1036267 Share on other sites More sharing options...
PFMaBiSmAd Posted April 3, 2010 Share Posted April 3, 2010 You do understand that you can install an Apache web server, php, and mysql on just about any personal computer. Quote Link to comment https://forums.phpfreaks.com/topic/197005-how-do-i-display-a-local-image/#findComment-1036269 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.