

You must detect which requests must go directly to the origin server.Unless you’re using an unusual font from a galaxy far, far away, it’s almost certain that anyone with whom you share your document will be able to read it using their copy of Word (or a free alternative like Libre Office). If the path handled by your Worker overlaps with the path where images are stored on your server, it could cause an infinite loop by the Worker trying to request images from itself. To perform resizing and optimizations, the Worker must be able to fetch the original, unresized image from your origin server.

If source images are stored in a location that is handled by a Worker, you must prevent the Worker from creating an infinite loop. For example, store your images in /originals/ directory, and handle resizing via /thumbnails/* path that fetches images from the /originals/ directory. It is best to keep the path handled by the Worker separate from the path to original (unresized) images, to avoid request loops caused by the image resizing worker calling itself. This will block all non-image requests and make your website inaccessible. WarningDo not set up the Image Resizing worker for the entire zone ( /*). It is also useful to set anim:false when using format:"json" to get the response quicker without the number of frames. This setting is recommended when enlarging images or processing arbitrary user content, because large GIF animations can weigh tens or even hundreds of megabytes. Setting it to false reduces animations to still images. Whether to preserve animation frames from input files. The fetch() function accepts parameters in the second argument inside the object. You can use Image Resizing to sanitize SVGs, but not to resize them. The resizing feature is accessed via the options of a fetch() subrequest inside a Worker. This is useful to adapt image sizes, formats and quality dynamically based on the device and condition of the network. You can store images in an external S3 bucket or a hidden folder on your server without exposing that information in URLs. Hide the actual location of the original image.Instead of specifying pixel dimensions in image URLs, use preset names such as thumbnail and large. Here are a few examples of the flexibility Workers give you: Using Image Resizing with Workers gives you powerful programmatic control over every image request.
