Copy link to clipboard
Copied
For a number of years I have used the following code to display a blank page containing a specified image when clicking on a thumbnail image:
<a href="blank.php?img=path/photoname.jpg"><img src="thumbnail path/name.jpg" /></a>
It now calls up a totally blank page. Has something changed in php? html? When code has worked for a long time and suddenly breaks, I assume something in the system has changed that I'm unaware of.
Thanks for any information.
Since you are assigning the image to a url variable 'img' nothing much will happen in the blank.php page unless you GET that variable:
<?php
$img = $_GET['img'];
echo '<img src="'.$img.'">';
?>
Hi Elizabeth - Can you post the full page source code please and it'll be easier for someone to help you ...
Copy link to clipboard
Copied
Since you are assigning the image to a url variable 'img' nothing much will happen in the blank.php page unless you GET that variable:
<?php
$img = $_GET['img'];
echo '<img src="'.$img.'">';
?>
Copy link to clipboard
Copied
The image is coming from a database. What confuses me is that this code has been working for over 6 years.
Copy link to clipboard
Copied
It doesnt matter where the image is coming from. If its coming from a database then the link probably looks similar to below:
<a href="blank.php?img=<?php echo $row['img']; ?>"><img src="<?php echo $row['thumbnail']; ?>"></a>
Not sure how its been working as it don't make any sense unless you GET the 'img' variable in the page its being passed to.
Copy link to clipboard
Copied
It's not being passed to the page. It is read. The path/filenames speccify references relative to the page that is calling them!
Copy link to clipboard
Copied
It's not being passed to the page. It is read. The path/filenames speccify references relative to the page that is calling them!
The way you have the link set up is you are passing a url variable 'img' to a page named 'blank.php' That page can only process the information being sent to it IF you GET the information contained in the variable from the url which is necessary for the image to be displayed on the page.
Perhaps you are trying to do something else or just getting mixed up with some other workflow - what is it you are trying to do?
Maybe this, which will open the image in a blank page?
<a href="fruits/apples.jpg" target="_blank">Apples</a>
Copy link to clipboard
Copied
Hi Elizabeth - Can you post the full page source code please and it'll be easier for someone to help you ...
Copy link to clipboard
Copied
WELL! The pages that use this code have lots of other stuff going on too, so I made a new page that did nothing but show an image directly and call a blank page that displayed the same image when the thumbnail was clicked. Then decided I should look at the blank page code. It begins with checking for $_GET['img'] but also had a bunch of old and obviously outdated code which I stripped out before including here. Now the code works! What I stripped out was old code intended to protect against bad input (which I had gotten from somewhere when I first started web stuff & didn't understand).
I wouldn't have gotten here if I hadn't needed to show you folks my code. THANK YOU for being there!
Copy link to clipboard
Copied
It begins with checking for $_GET['img']
Yes, exactly as I would have expected, mentioned and explained in my original reply to you but you went off on some other strange rant about much to do about nothing, before checking.
Copy link to clipboard
Copied
Yes, and you were right, and sometimes we just can't find the woods for the tree blocking the path... I should have checked ALL my code before posting. Still don't quite understand why stripping out old code fixed the problem, but I'm not looking back!