Skip to main content
ElizabethGailLittle
Inspiring
December 2, 2020
Answered

Old links are no longer working

  • December 2, 2020
  • 2 replies
  • 608 views

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 has been closed for replies.
Correct answer Paul-M

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

2 replies

Paul-MCorrect answer
Community Expert
December 2, 2020

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
ElizabethGailLittle
Inspiring
December 2, 2020

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!

Brainiac
December 2, 2020

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.

Brainiac
December 2, 2020

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

ElizabethGailLittle
Inspiring
December 2, 2020

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

Brainiac
December 2, 2020

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.