Apollo139
Forum Replies Created
-
Hi,
installer package and the API was fixed. Please, check the description of the plugin.Hi,
here is an update, which should works correctly: I send whole functionscissors_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"; } }
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: 'https://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.
Hi there is a solution:
1) open the file scissors.php in folder wp-content/plugins/scissors-continued
2) find functionscissors_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
I’m sorry. Tested on WP version 3.0.5 and 3.1, english/czech version.