Resizing or compression with Glitch CDN?

I’ve noticed that when we use Glitch CDN links, it appends a parameter v (I guess ‘version’) onto the URL.

I was wondering whether any other undocumented parameters exist for fixing height, width, or compression, to make images smaller.

Sometimes I upload a 1MB image at 2000x2000 but I only want to display it at 800x800. I have to resize and re-export it myself in IrfanView so it would be cool if the CDN could do it. Same goes for jpeg quality.

Anyone know?

1 Like

You could try to append gzip headers to retrieve gzipped files if that is an issue, however other than that I’m rather very unsure.

Thank you for the suggestion. In my opinion, gzipping a 1MB image is still a waste if the image only needs to be 170kb at display resolution. But really, thanks! :slight_smile:

Anytime!

Anyway, to be completely honest the Glitch CDN is probably not the right choice for the majority of people, the CDN lack a lot of features, like you said yourself regarding resizing, quality, and compression.

I have an image on my site, eddiestech.co.uk, that takes about a year to load. It’s from a DSLR so makes sense, but would be cool to compress it without using another site/software

1 Like

On the contrary, it probably is the right choice for the majority of users, but perhaps not for the minority of power users? :wink:

I can recommend IrfanView as a dead simple free image editor. It has been around for years and years but it does a great job of resizing and compression. Open your image, Ctrl+R to resize, set a new percentage (it preserves aspect ratio by default), hit S to Save as, set the jpeg quality… done! :camera::sparkles:

That said, I understand that it would be easier not to have to edit the image manually :slight_smile:

True, it really depends on the targeted users. I guess the Glitch CDN is a very simple CDN to use, however I’m not sure of how good it actually is when it comes to response times and so on.

I use paint.net most of the time. It’s also free :slight_smile:

I don’t think there are any other parameters, the v parameter is just to force the browser to retrieve a new version of the file.

1 Like

Good shout, I expect that’s true.

I had a mess around and tried w, h, c and q params, none of which did anything.

1 Like

What about width and height?

As far as we know, the assets CDN is a very thin layer on Amazon S3, and S3 doesn’t have that kind of functionality. I would expect the assets system not to add it. But if it really were undocumented, of course I wouldn’t know either :person_shrugging:

I don’t think the v parameter is done at the server even. Does putting in an older number really get a previous version? It looks like it’s more meant to bust caches in between S3 and a client.

1 Like

Hey hi, Glitch CDN may not support undocumented parameters for resizing or compressing images. You might need to preprocess images before uploading or looking alternative image processing services like any online application such as https://jpegcompressor.com/ it resize images well with supporting other image formats.

This would definitely be a pretty nice feature for Glitch to implement, the biggest use case for this probably for static sites when you don’t want to go through resizing it online.

Hey y’all I just happened to see this fly by and it made me realize that we’ve probably never talked about Image Optimization here.

Assets added in the last few years will use cdn.glitch.global for their domain, benefitting from Fastly’s POPs. Images can also be cached using images.glitch.global, which has the Fastly Image Optimizer enabled. Changing the domain part of the address of the asset (from cdn.glitch.com, say, or to images.glitch.global) is all you need to do to use the “new” caches - they will work on any Glitch project with assets uploaded via the assets drawer

You can check out a quick demo of a few of the features at https://iodized-mirror-weaver.glitch.me/

Cheers;
cori

5 Likes