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

Fixed Watermark Problem

Affected version


Well-known member
XFMG\Attachment\Media.php->Function onAssociation contains this...
if ($container->canAddWatermark(false) && !$container->canAddMediaWithoutWatermark())
    $mediaRepo = \XF::repository('XFMG:Media');
    $watermarkPath = $mediaRepo->getAbstractedWatermarkPath($options->xfmgWatermarking['watermark_hash']);
    if (\XF::app()->fs()->has($watermarkPath))
        $tempWatermark = \XF\Util\File::copyAbstractedPathToTempFile($watermarkPath);

        /** @var \XFMG\Service\Media\Watermarker $watermarker */
        $watermarker = \XF::service('XFMG:Media\Watermarker', $container, $tempWatermark);
Which is all fine and dandy, but XFMG\Service\Watermarker.php->function watermark contains this...
if (!$this->canWatermark())
    return false;
Which overrides the $container->canAddWatermark(false) and checks permissions before watermarking a new upload which can lead to an upload not being watermarked in some cases.

This may or may not be associated with the permission problem I reported here...

EDIT: I would suggest that any permission checks be done in the functions calling the service. Not in the service itself.
Last edited:

Chris D

XenForo developer
Staff member
I've made some changes here to make the code a bit clearer and moved the permission checks out of the service.

I'm not seeing the correlation between this bug and the permission one, but if you have further details on that, please post in that bug thread.