Nightasy Posted July 18, 2013 Share Posted July 18, 2013 Heya all, So I've completed my first semester on PHP programming. I got an A, ./flex ! Anyhow, I'm trying to take what I've learned and practice with it. I ran into a bit of a road block and after spending a day trying to figure it out I decided it was time to come ask the pros 8D. I have some thumbnails inside a folder that are dynamically generated when a user visits a page. What I am trying to do with the thumbnails is have them, when clicked, change the photo inside of an iframe. Unfortunately this is not working. Well, enough gabbing. Here's the code that is the culprit of my problem. I think. <?php require ('includes/photo_functions.php'); $images_dir = "uploads/" . $_SESSION['username'] . "/photos/"; $thumbs_dir = "uploads/" . $_SESSION['username'] . "/photos/thumbs/"; $thumbs_width = 200; $images_per_row = 3; /** generate photo gallery **/ $image_files = get_files($images_dir); if(count($image_files)) { $index = 0; foreach($image_files as $index=>$file) { $index++; $thumbnail_image = $thumbs_dir.$file; if(!file_exists($thumbnail_image)) { $extension = get_file_extension($thumbnail_image); if($extension) { make_thumb($images_dir.$file,$thumbnail_image,$thumbs_width,$extension); } } echo '<a href="#null" onClick="inner_Iframe.location="',$images_dir.$file,'" class="photo-link"><img class="photo-link" src="',$thumbnail_image,'" /></a>'; if($index % $images_per_row == 0) { echo '<div class="clear"></div>'; } } echo '<div class="clear"></div>'; } else { echo '<p>There are no images in this gallery.</p>'; } ?> Any help would be appreciated. I'm hoping this is a logical error or perhaps poorly placed quotations? Best Regards, Nightasy Link to comment https://forums.phpfreaks.com/topic/280264-change-iframe-with-generated-thumbnail/ Share on other sites More sharing options...
Nightasy Posted July 18, 2013 Author Share Posted July 18, 2013 I did some more testing and changed line 22 to this. echo '<a href="',$images_dir.$file,'" target="inner_Iframe"><img class="photo-link" src="',$thumbnail_image,'" /></a>'; Now it works on Google Chrome but on Internet Explorer and Firefox it always opens the image in a new window instead of displaying the image inside the iframe. Anyone know why those browsers are doing this but Chrome is not. Oh and btw, Chrome is giving me this error. Resource interpreted as Document but transferred with MIME type image/jpeg: "http://localhost/picpoof/uploads/Poofer/photos/4_Photo9.jpg". It code works in Chrome but that error is coming up. Link to comment https://forums.phpfreaks.com/topic/280264-change-iframe-with-generated-thumbnail/#findComment-1441176 Share on other sites More sharing options...
Nightasy Posted July 18, 2013 Author Share Posted July 18, 2013 I got it working now. Thanks to anyone that gave this a read. I had to change the code from iframe id='' to iframe name='' Link to comment https://forums.phpfreaks.com/topic/280264-change-iframe-with-generated-thumbnail/#findComment-1441178 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.