• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Attachment Improvements By Xon 1.1.3

No permission to download

Xon

Well-known member
#1
Xon submitted a new resource:

Attachment Improvements By Xon - A collection of improvements to XF's attachment system

A collection of improvements to XF's attachment system.
  • SVG support
  • Nginx's X-Accel-Redirect
  • New Permissions for forum/conversations (Respects global attachment size & count limits): -- Attachment Size (kb). -- Maximum Attachment Count.

As XenForo_FileOutput is not easily extensible, this add-on effectively reimplements:
  • XenForo_ViewAdmin_Attachment_View
  • XenForo_ViewPublic_Attachment_View

SVG Support
Support for SVG attachments to be...
Read more about this resource...
 

Xon

Well-known member
#4
Are there side effects of uninstalling the addon after usage?
No., it will revert to standard XenForo behaviour if this add-on is disabled or uninstalled.

But oops, I forgot to make it delete the permissions it leaves behind :p I'll fix that tomorrow.
 

BobbyWibowo

Well-known member
#5
When you upload a new SVG file and then embed it to the post as a thumbnail, it'll appear as full instead of thumbnail on the editor, but will display correctly as a thumbnail after you post it. Was that intentional?
 

Xon

Well-known member
#6
When you upload a new SVG file and then embed it to the post as a thumbnail, it'll appear as full instead of thumbnail on the editor, but will display correctly as a thumbnail after you post it. Was that intentional?
That sounds like a bug, but it is a while since I've touched the SVG attachment aspect. I'll need to have a look at it again.
 

BobbyWibowo

Well-known member
#7
My members aren't particularly using SVG files, so there have been no issue. I simply happened to encounter that issue while I was testing out things after I switched to this add-on from the nginx-accel only one.
 

Xon

Well-known member
#8
My members aren't particularly using SVG files, so there have been no issue. I simply happened to encounter that issue while I was testing out things after I switched to this add-on from the nginx-accel only one.
Looking into this more, and the entire thumbnail handling is broken. I've got a fix just under going testing and should be released in a day or two.

Next version will support thumbnail rebuilding and on install will kick off a rebuild of any SVG attachments.
 

Xon

Well-known member
#9

BobbyWibowo

Well-known member
#10
@Xon Got error after uploading an SVG file:
Code:
ErrorException: Fatal Error: Call to undefined method AttachmentViewer_XenForo_Model_Attachment::extractDimensionsForSVG() -library/SV/AttachmentImprovements/Deferred/SVGAttachmentThumb.php:35
 
Last edited:

BobbyWibowo

Well-known member
#12
@Axel B I'm pretty sure you can. You only need an nginx server if you want to enable the nginx-accel feature thing, which is actually disabled by default. Since it's disabled by default, I assume it's so that non-nginx users can use the other features.
 

Xon

Well-known member
#13
Hi m8,
I use the previous addon for SVG attachments. My website doesn't run on NGINX. Can I still use this addon?
The nginx-only parts are disabled by default.

@Xon Got error after uploading an SVG file:
Code:
ErrorException: Fatal Error: Call to undefined method AttachmentViewer_XenForo_Model_Attachment::extractDimensionsForSVG() -library/SV/AttachmentImprovements/Deferred/SVGAttachmentThumb.php:35
Did you by any chance have the add-on disabled when installed? Or switch it to disabled after installing?

This error happens when the deferred task runs but the add-on isn't enabled. I'll add some detection code so the deferred task exits out earlier rather than errors.
 

Xon

Well-known member
#16
@Xon For some reason, SVG is still not being treated as an image. Whenever I upload a new SVG file, it'll be treated as a normal file, so there's no option to add thumbnail o_O
This is the SVG file that I tried to upload: https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg
Also tried another one (UK flag), didn't work as well. There's no error on the error log by the way.
How it extracts the width/height is a bit fragile, I'll need to-do some tweaking.

:edit: Figured it out, I'm scanning the SVG for known-bad tags (such as <use xlink:href="..." />which can pull in external resources) and it is tripping over an internal reference which should be allowed.
 
Last edited:

Xon

Well-known member
#17
@BobbyWibowo after re-reading the SVG spec and some security presentations; removing the 'use' statement from the "Bad SVG tags" should be safe. Especially as the SVG file is being loading as an image which browser use to enforce a number of restrictions.

I'll soon release a version which gives an error message when an SVG is rejected.
 
Last edited:

Xon

Well-known member
#19

kontrabass

Well-known member
#20
Hi Xon!, found this addon whilst looking for SVG support, and it is working great! Thanks!

Regarding the X-Accel-Redirect functionality: am I correct in guessing that this would have the effect of freeing up resources of the webserver? I'm just a bit confused as to what the benefit actually is. And then to implement, we would just copy your 'location' directive suggestion for 'internal data in webroot', to our nginx vhost config file?

We have a ton of attachments and are running the latest nginx.

Thanks!!