Sizing images and cloudinary support


(Justin Gordon) #1

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:

Has anybody looked into integrating either of these?


(Jeff Atwood) #2

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?


(Justin Gordon) #3

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.


(Jeff Atwood) #4

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…


(Sam Saffron) #5

Are we sure about that discourse/nginx.sample.conf at master · 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