base64 Image Cached? - caching

I have an image encoded in base64 and in an HTML page.
Example:
<img src="data:image/jpeg;base64,/9j/4S/+...">
Simple question:
Is the above code cached or is it loaded every time the page loads? I find conflicting answers when I research the topic.

By "the above code cached" you mean if the image is decoded each time or if the browser keeps a decoded image cache in memory? If so, to me the answer is no, it won't keep the decoded image, only the data to decode the image again (the whole HTML in this case). Maybe I'm wrong, but that's what I will expect.

Related

Is it possible to resize base64 code representing the image?

I am using power autoamte to convert an image in base64, and then I put this code in html.
Here is what I do:
I convert the original image to base64
I put this code in the html content in the <img src='myBase64'>
tag.
I convert the html to pdf format
Everything is fine, but when my html file reaches more than 2 mb my flow stops working. This is the limit for this conversion operation.
My question is:
Is it possible to resize the base64 code? I know there are external connectors resize images like Encodian, but I don't want to use them.
I searched on the internet, but without much results.
Thank you in advance

Base64 img not showing after Winnovative PDFConverter HTML to PDF

I’ve been using the PDFConverter for years with no issues. And there are still no issues converting a large HTML form to PDF, except certain images aren’t showing.
I programmatically fill an HTML img element with a base64 string, like so:
imgSignature.Src = "data:image/jpg;base64," + Convert.ToBase64String(SignatureImage);
where SignatureImage is a byte[] array.
I've observed that if the byte[] array size is more than around 7K (not sure exactly the threshold), the image will not render to PDF (at least it’s not visible anyway). Anything under that displays fine. Note: the image displays in HTML just fine. It's when converting to PDF that it disappears if the byte array is too large
I've tried adjust the size of the img, the container it's in, everything I can think of.
Currently still going through Winnovative support docs but no luck so far.
Thanks for any advice.
Just in my case, I changed all images formats from jpeg to png, and it works for me. It's worth mentioning that my images are between 6kb to 8 kb (the images are Bar Codes)

images with invalid jpeg marker

I encountered a website where the images consistently throws 'invalid jpeg marker' error when downloaded. I am wondering is it possible that they are intentionally doing something which causes this error for most of the users who try to download and use their images?
I want to protect the jpeg resources of my website from unauthorised use. Is it possible to really change something in jpeg header or meta tags so that jpg images display fine on browser but if someone downloads it for their own use it throws an error 'invalid jpeg marker'?
(I don't intend to discuss alternative ways of protecting images online or the limitations of it.)
If it can display on a browser, it can display on something else. What is likely happening is that the decoder you are using to view when downloaded is more strict than your web browser. I presume you are not using your browser to view them after downloading.
You could run the "file" command to make sure the images are actually JPEGs. If so, there are a number of programs available to analyze the structure of a JPEG stream. You could use one to see what's going on with the image. You may have some odd marker ordering or possibly the JPEG image does not occur right at the start of the file stream. I've seen some weird JPEGs where there were extra bytes after the APPn marker and before the next JPEG marker. Some decoders ignored the extra bytes others puked.

is image format (suffix) always in url?

is image format (suffix) always in url? most of times is so, but when it is not, how the browser understand url is for image? I mean maybe some where in package there is format. is it so or the only way is parsing?
thanx
No. The extension and in fact the entire URL is completely irrelevant for the format of the image.
Image formats are determined by:
the "mime type" sent by the server, such as image/png or image/jpeg.
the first few bytes in the file contents, which will also tell you the image format. Your image editor (photoshop, etc) applies this type to the file.
Strictly speaking, the server is supposed to send the correct mime type. But most browsers also check the first few bytes of the file.

Sometimes images seem to be loading a lower resolution

Sometimes when I see a lower resolution load before I see the full image. This is not done in jQuery as it also happens when you load the image stand-alone. I have not a single idea how they do this, but I guess it's something server side.
My question is, how would I do this on my own server?
The images are stored in "progressive" or "interlaced" JPEG format, meaning that the low-res image data is stored before the high-res data (in layman's terms). You can encode any JPEG as interlaced. You can even do it on the server using imagemagick.
Here's Jeff Atwood talking about this.

Resources