Sizing images and cloudinary support

AI-generated summary

Sizing Images and Cloudinary Support

A discussion about image sizing and cloudinary support in Discourse has begun. justin_gordon suggests optimizing image sizes for topic/post views and creating a slideshow view for larger images. He also proposes using cloudinary.com or integrating image magic.

codinghorror reveals that automatic resizing/thumbnailing already happens with all images, regardless of how they are added to a topic. However, justin_gordon points out that uploading from an iPhone still requires resizing the image first.

codinghorror explains that there is a maximum upload size of 2 megabytes to prevent server crashes, which can be changed in the site settings. However, sam questions this, citing the client_max_body_size setting in the nginx.sample.conf file, which would need to be updated via a hook to change the maximum file upload size.

It’s awesome that we can drag & drop images. @codinghorror, Any thoughts on these ideas?

  1. If you make your images big, that’s great because you can click and expand. However, what if you want to have a post with 15 2048x2048 images. That could be a bit slow to load.

  2. If you want to upload from an iPhone 5, it requires too much extra work to resize the image on the phone.

  3. Ideally, when uploading images, an optimized smaller size would be created for the topic/post view, and clicking an image would bring up a slide show view of the appropriate size.

It seems like we might be able to use cloudinary.com, or maybe integrate image magic:

https://github.com/rmagick/rmagick

Has anybody looked into integrating either of these?

This automatic resizing/thumbnailing you are talking about already happens with all images, no matter how they are added to a topic (drag and drop, email attachment, upload button, paste). So I am not sure what you mean here?

That’s brilliant! I didn’t realize it. Good to know.

However, uploading from an iPhone requires resizing the image first.

Would you recommend making the max image size larger to accommodate direct iPhone uploads? Guessing that we don’t want directly uploads from my 24 megapixel SLR. However, it would be good know the pros/cons of just accepting any image size.

I guess what would be awesome would be for help links (question icons) next to each setting, and maybe they could link to a topic on the meta site for notes like this.

There is a maximum upload size to prevent griefing / crashing the server, it defaults to 2 megabytes. You can change that on your install to whatever you want via the site settings.

Otherwise I could just access your Discourse, upload a very large 1 gigabyte image (or a couple of them) and destroy it..

Are we sure about that discourse/config/nginx.sample.conf at main · discourse/discourse · GitHub

  # maximum file upload size (keep up to date when changing the corresponding site setting)
  client_max_body_size 2m;

You would need to add a hook to replace that in nginx to your template