Wordpress : Prevent from serving webp images on button-based download - wordpress

The png and jpg images of my Wordpress site are programatically converted into webp formats thanks to an extension (I've tried different, including WebP Converter for Media and WebP Express).
There are pages that display an image. I would like to add a button that enable users to download the image. I'm currently using the following code :
<a href="path/to/my/img.png" download="img">
<button type="button"> Download </button>
</a>
Nevertheless, upon hit, the image to be download corresponds to its webp version - not the png as encoded in the image path.
I would like to know :
Is it possible to force the server to serve the png image upon button click, either with a client side information (included in the image path, or in the ?) or with a server side condition (if page==X and request==Y, return png)?
(Worse but possible) Is it possible to prevent the server from converting png to webp, either by excluding some pages in a given extension, or by adding some php functions directly in the code ?
Otherwise, what other strategies have I missed to have webp images rendered but the ability to easily save as png?
Note: Chrome works as expected : png instead of webp image upon download, and, webp image upon save as on image directly. Firefox though download images as webp wether it is on the image or through the download button.

I haven't find a definitive general answer, but apparently, the WebP Express plugin skips URLs that contain a query string.
Therefore, if you ?original to the image URL in the link, you would "force" the serve not to encode your original png image into a webp format.
This just writes :
<a href="path/to/my/img.png?original" download="img">
<button type="button"> Download </button>
</a>
Note : I don't know whether this works with other plugins.

Related

image rotate plugin(in ckeditor) converts my uploaded images to data:uri

I use symfony with ckeditor for my forms. I have setup the 'image upload' plugin, and it works fine, uploading images in the disk.
Later I installed the 'rotate image' plugin.
When I upload my images they are in the server:
when I first rotate, they become inline:
The problem is that the data:uri is stored now in my database, and takes much longer to update than simply storing a disk uri.
After I rotate, is it possible to keep my images as were, not convert them to data:image?
That's not a problem of CKEditor itself, but just the way that the "rotate image" plugin works.
You should report the problem to its author

ImageResizer.Net - not resizing images

I have recently downloaded Image Resizer .Net due to being interested in to what it has to offer, you can see three libraries in the link I have supplied, I've gone ahead and downloaded all of them.
Rebuilt the project, then navigated to my view and specified a width,height and mode for an image that's getting displayed as shown here.
<img src="http://res.cloudinary.com/dncu6pqpm/image/upload/q_80/#profilePic?w=50&h=50&mode=crop">
This URL is of a car its width is 402 and its height is 300, I want to resize is just to test the functionality, but it doesn't seem to change its size? could this be to do with the fact its referencing an external image?
Update.
This is the rendered HTML
<img src="http://res.cloudinary.com/dncu6pqpm/image/upload/cunaulfla05xjzb5y2fe.jpg?w=50&h=50&mode=crop">
I read your question again and notice the part that your trying to apply it to an external image. Image Resizer will not work with external images as the images is requested directly to the external repository. In order for the image to be able to be resized it has to be served by your hosting server's IIS, where your website (with Image Resizer) is installed.
Make a quick test with a local image and see if that works.

Generate thumbnail from remote jpeg without downloading

I want to load the EXIF thumbnail preview stored in a jpeg image located on a remote server, without having to download the whole image. The server does not support resuming.
Is this possible? In detail, can I assume that the thumbnail image data is alway before the full image data so that I only have to download a maximum of (e.g.) 100kb which I can parse for the thumbnail data?
I was asking the same question and found this Greasemonkey script which adds thumbnail images to an Apache auto index page.
https://userscripts.org/scripts/review/5390
For each JPEG image link it issues a range request for the jpeg / jfif header, parses the thumbnail offset and thumbnail length tag then issues a further range request for the thumbnail, creates a data uri and assigns it to a new img object.
Unfortunately it only works for certain JPEG file formats.

Use image as thumbnails without save its

I want to genrate a thumbnails of image without save its differentlty
ImageResizer supports resizing images and it can output the thumbnail to a stream (for example a MemoryStream), so you don't have to save the image on disk. It has a very good support for ASP.NET and it can be installed using NuGet.

How to save image as jpeg file rather than aspx file? And if there's a way, how to convert it to jpg?

The images on my e-commerce website are watermarked with an aspx script, therefore when you are browsing products, if you want to save the image it saves it as aspx rather than jpg or png. The thing is I need to give urls of jpg for a website that advertises products. There are more than 10,000 products so I can't save all of them manually, so I made a page with jquery that get's the image part of the product display page. What this page returns is this:
<div id="result"><div id="loadpic" style="width: 160px;">
<img border="0" src="http://11.11.11.11/img/picsel.aspx?code=IPHONE-32GB-4">
</div></div>
And the output is only an image. How can I return this image not as an aspx page but as a jpg or png? Since there's a script for watermarking the image and making it aspx, shouldn't there be a reverse function?
The image is a jpg/png (depending on the mime type) regardless of the extension. Without knowing more about how you are saving the images, I can't give more of an answer, but you should be able to just save the image and change the extension. If you are doing the equivalent of File>Save, then you are saving the whole HTML (the divs, img tag, etc)

Resources