Skip to main content
ElizabethGailLittle
Inspiring
Dec 2, 2020 5:37 PM UTC
Answered

Old links are no longer working

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.

This topic is closed to new replies. Start a new post to keep the conversation going.
Paul-MCorrect answer
Legend
Dec 2, 2020 6:37 PM UTC

Hi Elizabeth - Can you post the full page source code please and it'll be easier for someone to help you ...

Paul-M - Community Expert

9 replies

Paul-MCorrect answer
Legend
Dec 2, 2020 6:37 PM UTC

Hi Elizabeth - Can you post the full page source code please and it'll be easier for someone to help you ...

Translate
Paul-M - Community Expert
ElizabethGailLittle
Inspiring
Dec 2, 2020 8:28 PM UTC

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!

Translate
Legend
Dec 2, 2020 8:34 PM UTC

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.

Translate
Legend
Dec 2, 2020 6:11 PM UTC

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.'">';
?>

Translate
ElizabethGailLittle
Inspiring
Dec 2, 2020 6:14 PM UTC

The image is coming from a database.  What confuses me is that this code has been working for over 6 years.

Translate
Legend
Dec 2, 2020 6:33 PM UTC

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.

 

 

Translate