Understanding Inline Attachments

Posted By: Baldeagle

Understanding Inline Attachments - 10/27/2018 6:55 PM

I'm trying to wrap my head around how the inline attachments work.

I'm going to describe what I think it means. Please correct me if I'm wrong.

Permissions/Forum/Max file attachment size determines the largest attachment allowed for upload

Attachments/Thumbnail Image Max Width/Height determines the max size of the inline thumbnails displayed at the bottom of a post

Attachments/Medium Image Max Width/Height determines the max size of the image displayed when you click on the inline images to view them

Attachments/Full Image Max Width/Height determines the max size of images stored in the attachment directory

Is my understanding correct? Or is the full-size image stored on the hard drive and only resized for viewing?
Posted By: Gizmo

Re: Understanding Inline Attachments - 10/27/2018 7:05 PM

The responsive page display takes priority over any image dimensions as a smart fallback; so mobile users can see a huge image on their tiny screens (otherwise they'd be bombarded by something that'd require them to scroll).

The images are processed with the compression settings you setup via the attachments settings; allowing an 8MB upload will allow a user to upload a huge image, that'll be compressed down.

The thumb max height/width affects the display of the thumbnail, medium I don't believe is used anymore, full is the max size the image can be stored as on the server.

If you look at the image information of my attached image you'll see that its scaled to 200x200 (thumb width) as a 30.73KB image (it was 49KB, so it was compressed); since the image was only 600x600 it didn't reach the full size max dimensions, so it retains the dimensions of the original.

Attached picture 3019770961872192759.jpg
Posted By: Baldeagle

Re: Understanding Inline Attachments - 10/27/2018 7:11 PM

OK. So, if we allow 5MB uploads, the size of the file stored in the attachments directory is determined by the setting we use for Attachments/Full Image Max Width/Height?

What determines the size of the images you view when you click on an inline array of images?
Posted By: Gizmo

Re: Understanding Inline Attachments - 10/27/2018 7:17 PM

If you allow 8MB-12MB uploads (which I recommend, since it's about the highest I've seen from cellphones), you'll end up with images around 400k-700k (depending on compression and full size dimension). They'll be resized to the full size dimensions only if the image exceeds that dimension (I allow 1920 as the max).

The FILESIZE is determined based on the image dimensions and the compression; it'll vary by image, especially using an image with a lot of detail.

When you click on an image and it opens in the lightbox, or you display inline, it should display the image with the css "max-width: 100%;"; which means as wide as the screen allows before trying to stretch the page.

Attached Image:
Original: 7,147 KB, 3036x4048
Parsed: 673 KB, 1440x1920

Compression level for full images: 60%

Attached picture IMG_20181020_143838.jpg
Posted By: Baldeagle

Re: Understanding Inline Attachments - 10/27/2018 7:22 PM

Thanks. That's the clarification I needed.
Posted By: Gizmo

Re: Understanding Inline Attachments - 10/27/2018 7:25 PM

I just uploaded an image from this last weekends camping trip; I chose it because of the level of detail, to show an example of compression on a large image.
Posted By: Baldeagle

Re: Understanding Inline Attachments - 10/29/2018 6:52 PM

I've been doing some testing, and I have some questions.

I uploaded a 3.8 MB image as an attachment. Instead of being displayed inline, it displayed as a link. On the hard drive, it was 2.2MB, which is 60% of its original size, so the compression is working as expected. But I *thought* that the file's size would be reduced to 650 pixels (the setting we have in attachments), and it was not.

When I deleted the post, the attachment was deleted as well, although its record was retained in the database.

What am I missing?
Posted By: Gizmo

Re: Understanding Inline Attachments - 10/29/2018 7:18 PM

The end filesize depends on the image quality you allow (defaults are thumb 200, medium 480, full 1920) and the max dimension you allow (if an image doesn't meet the dimension it will not be resized; the defaults are thumb 80%, medium 70%, full 60%), the level of detail the image has, and the Image Library you're utilizing to process images.

ImageMagick will process images more efficiently, and will more aggressively compress images; the downside is that it doesn't come pre-bundled with PHP like GD (it has to be installed to the local filesystem). Your host likely has it installed, you just have to populate the paths in the UBB.threads "Paths" configuration. I believe there was previously an issue with IM processing image dimensions (the system was rewritten in v7.6.2, whereas the following link is a patch for v7.6.1.1), that discussion can be found here.

The "Max File Size for Displaying Attached Images Inline" setting in the Attachments Settings will allow you to limit the images being displayed to the browser based on how large the image is; I wouldn't have this setting much higher than about a meg as your mobile users will have some pretty large images to push through their data plan.
Posted By: Baldeagle

Re: Understanding Inline Attachments - 10/29/2018 8:51 PM

I have ImageMagick installed and enabled. I read the referenced post and edited the image.inc.php file, and uploads/attachments now work as expected. Thanks for your help.
© 2019 UBB.threads PHP Forum Software Community