Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of SVG image attachments and WYSIWYG attachment previews #7721

Merged

Conversation

Sesquipedalian
Copy link
Member

Fixes #7719 by showing SVG attachments as images.

The fiddliest part was handling thumbnails. SVG images don't need thumbnails for obvious reasons, but SMF assumes that images do need them. So I had to add some special handling for SVGs to tell SMF that the SVG image is its own thumbnail, and then slightly tweak the JavaScript used to expand thumbnails when the user clicks on them.


Fixes #7720 by showing original images for embedded attachments in WYSIWYG editor.

The basic task of switching from thumbnails to original images merely required changing thumb to image on the relevant line in jquery.sceditor.smf.js. However, to prevent the download counter from incrementing unexpectedly, I also had to resurrect the preview URL parameter in ShowAttachment.php as a way to tell SMF that this shouldn't count as a download.

@Sesquipedalian Sesquipedalian changed the title Improve handling of image attachments Improve handling of SVG image attachments and WYSIWYG attachment previews Mar 25, 2023
@jdarwood007 jdarwood007 added this to the 2.1.5 milestone Mar 26, 2023
@Sesquipedalian Sesquipedalian force-pushed the svg_attachments branch 2 times, most recently from fa0b7a2 to 023794c Compare March 26, 2023 19:19
@Sesquipedalian
Copy link
Member Author

Ready for another review, @live627.

@Sesquipedalian Sesquipedalian merged commit 2148c43 into SimpleMachines:release-2.1 Sep 14, 2023
@Sesquipedalian Sesquipedalian deleted the svg_attachments branch September 14, 2023 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants