Title: Uploads bypass Imsanity plugin
Last modified: September 24, 2020

---

# Uploads bypass Imsanity plugin

 *  Resolved [justmigrating](https://wordpress.org/support/users/justmigrating/)
 * (@justmigrating)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/)
 * Client’s website allows members to upload photos, but the uploaded images bypass
   the Imsanity plugin that resizes large uploads. Is there an image resize plugin
   that works with the WP File UPload plugin to resize uploads?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fuploads-bypass-imsanity-plugin%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13455309)
 * Hi, open the visual editor of the plugin, go to Interoperability tab and activate
   option “Include Uploaded Files in Media”. This will make the uploaded files be
   added in Media Library of your website and maybe they will be resized by Imsanity
   plugin.
 * Try it and let me know.
 * Regards
 * Nickolas
 *  Thread Starter [justmigrating](https://wordpress.org/support/users/justmigrating/)
 * (@justmigrating)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13455487)
 * Nickolas-
 * The “Include Uploaded Files in Media” is checked (and the images get added to
   the Media Library just fine), but I’ve tried three different “image resize” plugins
   and all of them fail to resize images that are uploaded using the WordPress File
   Upload plugin. Of course, the images can be resized manually after upload, but
   with the number of members my client has, and each member will be uploading multiple
   images, we are hoping to find a way to handle the resizing automatically. I also
   have reduced the maximum file size to 1MB. I’m just surprised that the file upload
   bypasses the resize plugins.
 * Jennifer
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13468936)
 * Hi. I have very limited online access these days and I delay responding.
 * It seems that these resize plugins are hooked to the default upload form of WordPress
   Media Library.
 * Can you tell me their names? Maybe I can figure out a way to integrate with one
   of them.
 * Nickolas
 *  Thread Starter [justmigrating](https://wordpress.org/support/users/justmigrating/)
 * (@justmigrating)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13469627)
 * Nickolas-
 * The image-upload-resizer plugin I use the most is Imsanity. I also tried EWWW
   Image Optimizer by Exactly WWW and Smush by WPMU DEV.
 * Jennifer
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13470907)
 * Hi, try this hook. You need to put it in functions.php file of your theme:
 *     ```
       if (!function_exists('wfu_after_upload_ims')) {
       	function wfu_after_upload_ims($changable_data, $additional_data) {
       		foreach ( $additional_data["files"] as $file ) {
       			if ( $file["upload_result"] == "success" || $file["upload_result"] == "warning" ) {
       				$params["file"] = wfu_basename($file["filepath"]);
       				$params["url"] = str_replace(ABSPATH, site_url().'/', $file["filepath"]);
       				$params["type"] = wfu_mime_content_type($file["filepath"]);
       				if ( function_exists("imsanity_handle_upload") ) imsanity_handle_upload( $params );
       			}
       		}
       		return $changable_data;
       	}
       	add_filter('wfu_after_upload', 'wfu_after_upload_ims', 10, 2);
       }
       ```
   
 * It should work with imsanity. I haven’t tested it though, so let me know if it
   works.
 * Nickolas
 *  Thread Starter [justmigrating](https://wordpress.org/support/users/justmigrating/)
 * (@justmigrating)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13471520)
 * Nickolas-
 * It didn’t work, but thank you for trying.
 * Jennifer
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13488197)
 * Ok I managed to make it work. Here is the correct hook:
 *     ```
       if (!function_exists('wfu_after_upload_ims')) {
       	function wfu_after_upload_ims($changable_data, $additional_data) {
       		foreach ( $additional_data["files"] as $file ) {
       			if ( $file["upload_result"] == "success" || $file["upload_result"] == "warning" ) {
       				$params["file"] = $file["filepath"];
       				$params["url"] = str_replace(ABSPATH, site_url().'/', $file["filepath"]);
       				$params["type"] = wfu_mime_content_type($file["filepath"]);
       				if ( function_exists("imsanity_handle_upload") ) imsanity_handle_upload( $params );
       				wfu_process_media_insert($file["filepath"], $file["user_data"], 0);
       			}
       		}
       		return $changable_data;
       	}
       	add_filter('wfu_after_upload', 'wfu_after_upload_ims', 10, 2);
       }
       ```
   
 * Please note that you need to deactivate “Add Uploaded Files in Media” in the 
   shortcode. The hook will make sure by its own that files are added in Media.
 * Regards
 * Nickolas
 *  Thread Starter [justmigrating](https://wordpress.org/support/users/justmigrating/)
 * (@justmigrating)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13488487)
 * Nickolas –
 * Yes!! This works. Thank you so much.
 * Jennifer
 *  Plugin Author [nickboss](https://wordpress.org/support/users/nickboss/)
 * (@nickboss)
 * [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13496336)
 * ok nice

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Uploads bypass Imsanity plugin’ is closed to new replies.

 * ![](https://ps.w.org/wp-file-upload/assets/icon-256x256.png?rev=3252590)
 * [Iptanus File Upload](https://wordpress.org/plugins/wp-file-upload/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-file-upload/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-file-upload/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-file-upload/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-file-upload/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-file-upload/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [nickboss](https://wordpress.org/support/users/nickboss/)
 * Last activity: [5 years, 8 months ago](https://wordpress.org/support/topic/uploads-bypass-imsanity-plugin/#post-13496336)
 * Status: resolved