Title: [Plugin: Scissors Continued] Custom image sizes aren&#039;t handled
Last modified: August 19, 2016

---

# [Plugin: Scissors Continued] Custom image sizes aren't handled

 *  Moderator [Helen Hou-Sandi](https://wordpress.org/support/users/helen/)
 * (@helen)
 * Core Lead Developer and 4.0, 4.7, and 5.6 Release Lead
 * [15 years, 2 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/)
 * When you do a crop (whether full chain or specific), custom image sizes added
   via add_image_size are replaced but with the full size of the crop, rather than
   the specified image size. Proportions are also from the crop itself, not as defined.
 * [http://wordpress.org/extend/plugins/scissors-continued/](http://wordpress.org/extend/plugins/scissors-continued/)

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

 *  [Kitefr](https://wordpress.org/support/users/kitefr/)
 * (@kitefr)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980373)
 * i wanted to push this one topic because it’s the only thing who still annoying
   me with this plugin…
 * Otherwise, it is really great !
 * I hope an update of the plugin will be come very soon…
 *  [pixeline](https://wordpress.org/support/users/pixeline/)
 * (@pixeline)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980374)
 * Indeed, a fix would be nice. In the meanwhile, everytime you scissor an image,
   make sure to rebuild thumbnails using the “rebuild thumbnails” plugin.
 *  [Apollo139](https://wordpress.org/support/users/aloziak/)
 * (@aloziak)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980391)
 * Hi there is a solution:
 * 1) open the file scissors.php in folder wp-content/plugins/scissors-continued
   
   2) find function `scissors_admin_head()`, it is somewhere arround 887 line 3)
   uncomment (or delete) line with this command:
 *     ```
       foreach(array('large', 'medium', 'thumbnail') as $size)"
       ```
   
 * 4) add two new lines:
 *     ```
       $intermediate_image_sizes = get_intermediate_image_sizes();
       foreach ($intermediate_image_sizes as $size)
       ```
   
 * 5) that’s all
 * notes:
    – be sure about cache, sometimes it needed to referesh page more than
   one time – the name of custom sizes shouldn’t have any space; “MyCustomSize” 
   is correctly instead of “My Custom Size”
 * I’ve tested it only in one site, so that I don’t guarantee functionality.
 * If you have any idea or feedbacks, please, write it.
 * Alex
 *  [Apollo139](https://wordpress.org/support/users/aloziak/)
 * (@aloziak)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980392)
 * Just one note:
    – I use plugin “Simple Image Size” for add custom image size –
   I’ve checked that I have to change a few times a “crop” settings until the Crop
   function will works – You can check correct functionality the Crop function if
   you show source code of admin page (Media->AnyImage->Edit, Settings->Media) and
   inside of <head></head> tag find:
 *     ```
       <script type='text/javascript'>
       /* <![CDATA[ */
       scissors = {
       ajaxUrl: 'http://mysite.com/wp-admin/admin-ajax.php',
       thumbnailAspectRatio: 2,
       mediumAspectRatio: 1,
       largeAspectRatio: 1.14285714286,
       MyCustomSize: 0.75,
       }
       /* ]]> */
       </script>
       ```
   
 * Inside of this you should find the name of your custom image size (in my case“
   MyCustomSize”) and correct aspect ratio (0.75). If there is “0” (zero) so here
   is some mistake. Try to delete it and add again, refresh page, change crop settings
   to false/true.
 *  [Apollo139](https://wordpress.org/support/users/aloziak/)
 * (@aloziak)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980394)
 * Hi,
    here is an update, which should works correctly: I send whole function `
   scissors_admin_head()`
 *     ```
       function scissors_admin_head()
       {
       	if(strstr($_SERVER['REQUEST_URI'], 'media'))
       	{
       		global $scissors_dirname;
   
       		wp_enqueue_script('scissors_crop', '/' . PLUGINDIR . '/'.$scissors_dirname.'/js/jquery.Jcrop.js', array('jquery') );
       		wp_enqueue_script('scissors_js', '/' . PLUGINDIR . '/'.$scissors_dirname.'/js/scissors.js' );
   
       		$thisUrl = admin_url('admin-ajax.php');
       		echo "<!-- JS loaded for Scissors in media library -->\n";
       		echo "<script type='text/javascript'>\n/* <![CDATA[ */\n";
   
       		echo "scissors = {\n";
       		echo "ajaxUrl: '$thisUrl'";
   
       		$intermediate_image_sizes = get_intermediate_image_sizes();
   
       		foreach ($intermediate_image_sizes as $size) {
       			if ($size=='large' || $size=='medium' || $size=='thumbnail') {
       				// standard WP sizes large, medium, thumbmnail
       				$width = intval(get_option("{$size}_size_w"));
       				$height = intval(get_option("{$size}_size_h"));
       				$aspectRatio = max(1, $width) / max(1, $height);
       				if(!get_option("{$size}_crop")) $aspectRatio = 0;
       			} else {
       				// custom image sizes
       				$custom_image_sizes = get_option( 'custom_image_sizes' );
       				if (!empty($custom_image_sizes)) {
       					$width = $custom_image_sizes[$size]['w'];
       					$height = $custom_image_sizes[$size]['h'];
       					$aspectRatio = max(1, $width) / max(1, $height);
       					if(!$custom_image_sizes[$size]['c']) $aspectRatio = 0;
       				}
       			}
       			echo ",\n{$size}AspectRatio: $aspectRatio";
       		}
   
       		echo "\n}\n";
       		echo "/* ]]> */\n</script>\n";
       		echo "<!-- End of JS loaded for Scissors in media library -->\n";
       	}
       }
       ```
   
 *  [tomdizzle](https://wordpress.org/support/users/tomdizzle/)
 * (@tomdizzle)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980399)
 * ales,
    doesnt work 🙁
 *  [davidstinemetze](https://wordpress.org/support/users/davidstinemetze/)
 * (@davidstinemetze)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980402)
 * Ales’s solution appears to require the “Simple Image Size” plugin. Additionally,
   there seems to be a bug when “post-thumbnail” is a size option. Because post-
   thumbnail contains a hyphen, it’s causing a JavaScript issue when it tries to
   declare the variable because it’s not in quotes.
 * I have modified Ales’s hack so that it doesn’t require you to install an additional
   plugin and fixed this post-thumbnail bug.
 * First of all, I added the $_wp_additional_image_sizes variable to the global 
   variable scope of the function.
 *     ```
       global $scissors_dirname, $_wp_additional_image_sizes;
       ```
   
 * Now, when not dealing with standard sizes, it pulls the dimensions from the $
   _wp_additional_image_sizes variable.
 *     ```
       if (isset($_wp_additional_image_sizes[$size])) {
       	$width = $_wp_additional_image_sizes[$size]['width'];
       	$height = $_wp_additional_image_sizes[$size]['height'];
       	$aspectRatio = max(1, $width) / max(1, $height);
       	if(!$_wp_additional_image_sizes[$size]['crop']) $aspectRatio = 0;
       } else {
       	$aspectRatio = 0;
       }
       ```
   
 * Finally, to fix the post-thumbnail JavaScript issue, I changed
 *     ```
       echo ",\n{$size}AspectRatio: $aspectRatio";
       ```
   
 * to
 *     ```
       echo ",\n'{$size}AspectRatio': $aspectRatio";
       ```
   
 * So the final function should look something like this:
 *     ```
       function scissors_admin_head()
       {
       	if(strstr($_SERVER['REQUEST_URI'], 'media'))
       	{
       		global $scissors_dirname, $_wp_additional_image_sizes;
   
       		wp_enqueue_script('scissors_crop', '/' . PLUGINDIR . '/'.$scissors_dirname.'/js/jquery.Jcrop.js', array('jquery') );
       		wp_enqueue_script('scissors_js', '/' . PLUGINDIR . '/'.$scissors_dirname.'/js/scissors.js' );
   
       		$thisUrl = admin_url('admin-ajax.php');
       		echo "<!-- JS loaded for Scissors in media library -->\n";
       		echo "<script type='text/javascript'>\n/* <![CDATA[ */\n";
       		echo "scissors = {\n";
       		echo "ajaxUrl: '$thisUrl'";
   
       		$intermediate_image_sizes = get_intermediate_image_sizes();
       		foreach ($intermediate_image_sizes as $size) {
       			if ($size=='large' || $size=='medium' || $size=='thumbnail') {
       				// standard WP sizes large, medium, thumbmnail
       				$width = intval(get_option("{$size}_size_w"));
       				$height = intval(get_option("{$size}_size_h"));
       				$aspectRatio = max(1, $width) / max(1, $height);
       				if(!get_option("{$size}_crop")) $aspectRatio = 0;
   
       			} else {
       				if (isset($_wp_additional_image_sizes[$size])) {
       					$width = $_wp_additional_image_sizes[$size]['width'];
       					$height = $_wp_additional_image_sizes[$size]['height'];
       					$aspectRatio = max(1, $width) / max(1, $height);
       					if(!$_wp_additional_image_sizes[$size]['crop']) $aspectRatio = 0;
       				} else {
       					$aspectRatio = 0;
       				}
       			}
       			echo ",\n'{$size}AspectRatio': $aspectRatio";
       		}		
   
       		echo "\n}\n";
       		echo "/* ]]> */\n</script>\n";
       		echo "<!-- End of JS loaded for Scissors in media library -->\n";
       	}
       }
       ```
   
 *  [madisn](https://wordpress.org/support/users/madisn/)
 * (@madisn)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980403)
 * Custom image sizes remain unchanged.
    Same fix should be used in the **scissors_crop()**
   function.
 *     ```
       function scissors_crop($post, $srcfile, $src)
       {
       	global $_wp_additional_image_sizes;
       .
       .
       .
       ```
   
 * And line ~1250:
 *     ```
       if ($size=='large' || $size=='medium' || $size=='thumbnail') {
       $resized = scissors_image_make_intermediate_size($dstfile, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop"), get_option("{$size}_adaptive"));
       }
       else{
       $nwidth = $_wp_additional_image_sizes[$size]['width'];
       $nheight = $_wp_additional_image_sizes[$size]['height'];
       $ncrop = $_wp_additional_image_sizes[$size]['crop'];
       $nadaptive = $_wp_additional_image_sizes[$size]['adaptive'];
       $resized = scissors_image_make_intermediate_size($dstfile, $nwidth, $nheight, $ncrop, $nadaptive);
       }
       ```
   

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

The topic ‘[Plugin: Scissors Continued] Custom image sizes aren't handled’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/scissors-continued.svg)
 * [Scissors Continued](https://wordpress.org/plugins/scissors-continued/)
 * [Support Threads](https://wordpress.org/support/plugin/scissors-continued/)
 * [Active Topics](https://wordpress.org/support/plugin/scissors-continued/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/scissors-continued/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/scissors-continued/reviews/)

 * 8 replies
 * 7 participants
 * Last reply from: [madisn](https://wordpress.org/support/users/madisn/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-scissors-continued-custom-image-sizes-arent-handled/#post-1980403)
 * Status: not resolved