Attachment Improvements By Xon

Attachment Improvements By Xon 2.6.3

No permission to download
Hi Xon,

in the XF 2.1rc ACP I can set as a usergroup permission a maximum file size i.e. to 1MB.

But this blocks the upload of images if it is exceeded.

If I install your addon, can I then set the XF maximum usergroup permisson to a higher level, i.e. 20MB, and still get each upload converted to i.e. 500KB, If I set 500KB in your addon in that forum?

Does this works also for the MediaGallery?
 
Hi Xon,

in the XF 2.1rc ACP I can set as a usergroup permission a maximum file size i.e. to 1MB.

But this blocks the upload of images if it is exceeded.

If I install your addon, can I then set the XF maximum usergroup permisson to a higher level, i.e. 20MB, and still get each upload converted to i.e. 500KB, If I set 500KB in your addon in that forum?
No, it allows uploads to the higher limit. The uploads are not converted in size.

Does this works also for the MediaGallery?
No, I haven't added XFRM or XFMG support.
 
Could it be that is not working in the final 2.1 release?

  • Global limit is set to 1024 kb.
  • Default user group is set to 500 kb.
  • upload >500 KB image works, even if the usergroup is set to 500kb.
  • It reports the image larger then it is: image is 800kb, Xen reports its 1.3 MB...
It looks like it just ignores the limits...
 
  • Global limit is set to 1024 kb.
  • Default user group is set to 500 kb.
  • upload >500 KB image works, even if the usergroup is set to 500kb.
Screenshot the output of the 'analyses permissions' for that user in a given forum, with the size limit expanded. (ie is there another usergroup raising the limit.

It reports the image larger then it is: image is 800kb, Xen reports its 1.3 MB...
This is expected as XenForo transcodes most images.
 
Screenshot the output of the 'analyses permissions' for that user in a given forum, with the size limit expanded. (ie is there another usergroup raising the limit.

I have tested it with two diffrent users and made sure they are not in any other group then the default 'registerd'.

The default registerd user group permission analyse:

194426

The default node permission analyse:
194427

It does not give a error 'to large' when uploading a 800kb file.

I'm testing this on Xamp with php 7.1, no idea if that makes any diffrence :)
 
Could it be that is not working in the final 2.1 release?

  • Global limit is set to 1024 kb.
  • Default user group is set to 500 kb.
  • upload >500 KB image works, even if the usergroup is set to 500kb.
  • It reports the image larger then it is: image is 800kb, Xen reports its 1.3 MB...
It looks like it just ignores the limits...
That's because the code in this addon does nothing to post attachments:
PHP:
<?php

namespace SV\AttachmentImprovements\XF\Attachment;

class Post extends XFCP_Post
{
    public function getConstraints(array $context)
    {
        $constraints = parent::getConstraints($context);

        $thread = null;
        $nodeId = null;
        $em = \XF::app()->em();

        if (!empty($extraContext['node_id']))
        {
            $nodeId = $extraContext['node_id'];
        }
        else if (!empty($extraContext['thread_id']))
        {
            /** @var \XF\Entity\Thread $thread */
            $thread = $em->find('XF:Thread', $extraContext['thread_id']);
            if ($thread)
            {
                $nodeId = $thread->node_id;
            }
        }
        else if (!empty($extraContext['post_id']))
        {
            /** @var \XF\Entity\Post $post */
            $post = $em->find('XF:Post', $extraContext['post_id']);
            if ($post)
            {
                /** @var \XF\Entity\Thread $thread */
                $thread = $em->find('XF:Thread', $post->thread_id);
                if ($thread)
                {
                    $nodeId = $thread->node_id;
                }
            }
        }

        if ($nodeId)
        {
            $constraints = $this->svUpdateConstraints($constraints, $nodeId, $thread);
        }

        return $constraints;
    }
    ...

$extraContext is not defined. Replace it with $context and it will work.

This is file: src/addons/SV/AttachmentImprovements/XF/Attachment/Post.php

@Xon it's a typo, please fix.

I'd also appreciate a version that allows to only activate additional permissions. I had to edit the addon to disable all the other features.
 
Hi,

First of all, thanks a lot for making this extension. I have a problem with it, I can upload svg attachments, however they are not displaying on the full screen and not displaying in post, does not matter if full image or thumbnail. I am using ngxin and did proper config as suggested.
Any help would be appreciated, thank you!

The svg file is available for download after pressing on it, working properly, so it's only about the display.
 
Make sure you have SVG listed as a valid image attachment ("Allowed Image Attachment File Extensions" option). Otherwise open a ticket on my site and share the SVG which isn't working so I can test
 
Does this allow me to permit higher attachment counts for my staff than my regular users, or does this only allow changes per-forum? That's not quite clear to me from the description.
 
per user-group per forum. So both! (you need to raise the global limit, then restrict regular users down. Same end result)
 
Nope.

That can be done with via the stock mountable file systems that XenForo supports;

example of using s3 which should be adaptable;

I haven't done this myself, but this sort of thing is doable with some work
 
Back
Top Bottom