ankuj2004 Posted April 23, 2013 Share Posted April 23, 2013 Hi ,I am trying to display some images which are not in my root directory. Lets say the image path is C:\Users\Public\Pictures\Sample Pictures and my website is at c:/xampp/htdocs/test.I have been able to get the path of the Images using Directory Iterator. Now I need to display each of these images in a popup. For that I am using the following Javascript function newPopup(url) { popupWindow = window.open( path+url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes') } and I am calling it from MY php fille as echo '<td width="150"><a href="JavaScript:newPopup(\''.$url.'\');">ScreenShot</a></td>'; where $url is path of file as C:/Users/Public/Pictures/Sample Pictures/001.jpg.But the popup does open but web browser throws the error that it can open the specified file as it does not understands it. Quote Link to comment https://forums.phpfreaks.com/topic/277192-display-images-not-in-root-in-javascript-popup/ Share on other sites More sharing options...
trq Posted April 23, 2013 Share Posted April 23, 2013 A browser can only browse to files that it has access to. Quote Link to comment https://forums.phpfreaks.com/topic/277192-display-images-not-in-root-in-javascript-popup/#findComment-1426077 Share on other sites More sharing options...
ankuj2004 Posted April 23, 2013 Author Share Posted April 23, 2013 I have tried to modify the code by using a php script which receives the url and displays it. $url = "pictures.php?url=". $url; echo '<td width="150"><a href=\''.$url.'\' target= "_blank">ScreenShot</a></td>'; in picture.php <?php $image = $_GET['url']; $getInfo = getimagesize($image); header('Content-type: ' . $getInfo['mime']); readfile($image); ?> But it says that The image can not be displayed as it contains error. Any hint about this problem as I am stuck on it for quite some time Quote Link to comment https://forums.phpfreaks.com/topic/277192-display-images-not-in-root-in-javascript-popup/#findComment-1426143 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.