I am having an issue in WordPress admin, where the images are not cropping in WP \"edit image\" for a site I am creating and I do not know what the cause is.
I\'ve r
None of the above worked for me. So in an effort to give back after taking so much from stackoverflow, here is what I did:
Sometime during the install process a URL rewrite rule was created in IIS. I disabled this rule and then the image crop worked!
I found that in my OVH WordPress server, version 4.7.5, imagemagick was not installed and is required for this function to work properly:
sudo apt-get install imagemagick
sudo service apache2 restart
I re-saved the functions.php
file with file encoding UTF-8
. It worked for me.( Windows 10 )
After ruling out several causes
( PHP modules, memory limits ), trying to get useful debugging info, and migrating the site to different hosting, I found that the problem was caused by rewrite rules in the .htaccess
file.
In this case the rules where added by the security plugin All In One WP Security. Maybe, a newer version of the plugin would have fixed it, but I replaced it with another security plugin some time ago.
With removing all rules from the .htaccess
and gradually reintroducing them I
discovered that the specific block of lines in .htaccess
causing the problem was:
# 5G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (\\|\.\./|`|='$|=%27$) [NC,OR]
RewriteCond %{QUERY_STRING} (\;|'|\"|%22).* (union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR]
RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR]
RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR]
RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC]
RewriteRule .* - [F]
</IfModule>
Keep in mind, the interface is not intuitive and it's easy to forget that the [Save] button is still deactivated if you do the following:
You must do the opposite.
I tried everything here, but nothing helped. Eventually, I found an article which mentioned giving IIS_IUSRS
permissions to the WP folder. And that finally got the crop tool working.