Look at this:
<a href="https://asdf.com/asdf.jpg">
<img src="https://asdf.com/asdf.jpg" width=100 height=100>
</a>
As you can see, the same image URL is used. The thumbnail one is obviously resized. And clicking on it, shows the image without size restrictions, as expected.
My question. Is it possible to do it by replacing the image link by its base64-encoded content, like this "data:image;base64,/9j/4AAQSk...BK//2Q==" ?
Reason: I am creating a self-contained single page with the content of a bunch of images.
But here are two problems.
- href does not seem to work with this type of content.
- even if it worked, repeating the content (in both href and src attributes) would mean a terrible waste of space.
Any ideas? Thanks =)
Edit (2023-03-17)
I've just got rid of the anchor, and added this to the img tag:
onclick='window.open("","_self").document.write("<img src=\""+src+"\" onclick=\"location.reload()\">")'
The reload() is necessary since I found no way of going back to the previous page (because there isn't any). But it's fine since the resources are local.
Opening the image in a new window is even simpler:
onclick='window.open().document.write("<img src=\""+src+"\">")'