• Resolved Erik Molenaar

    (@erikmolenaar)


    Hi,

    Does this plugin provide a PHP hook so I can disable its functionality (resizing/recompressing) on certain conditions (e.g. for admins).

    Looking forward to your reply. Thanks for this awesome plugin!

    Kind regards
    Erik

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    While we don’t have a filter for that, you can add ‘noresize’ into the filename of any image and Imsanity will ignore it.

    If Imsanity was called from something like this would it work using the current_user_can hook?

    /**
     * Filter the upload size limit for non-administrators.
     *
     * @param string $size Upload size limit (in bytes).
     * @return int (maybe) Filtered size limit.
     */
    function filter_site_upload_size_limit( $size ) {
        // Set the upload size limit to 10 MB for users lacking the 'manage_options' capability.
        if ( ! current_user_can( 'manage_options' ) ) {
            // 10 MB.
            $size = 1024 * 10000;
        }
        return $size;
    }
    add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 20 );

    Credit: Function contributed by Drew Jaynes — 6 years ago

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Hook to disable functionality?’ is closed to new replies.