Skip to content

Instantly share code, notes, and snippets.

@fahdi
Created December 31, 2013 17:37
Show Gist options
  • Save fahdi/8200046 to your computer and use it in GitHub Desktop.
Save fahdi/8200046 to your computer and use it in GitHub Desktop.
How to crop uploaded images instead of scaling them Would you like to crop your thumbnails instead of scaling them? If yes, I have a very handy snippet for you today. Just read on and enjoy! Just add the code below to your functions.php file:
<?php
// Standard Size Thumbnail
if(false === get_option("thumbnail_crop")) {
add_option("thumbnail_crop", "1"); }
else {
update_option("thumbnail_crop", "1");
}
// Medium Size Thumbnail
if(false === get_option("medium_crop")) {
add_option("medium_crop", "1"); }
else {
update_option("medium_crop", "1");
}
// Large Size Thumbnail
if(false === get_option("large_crop")) {
add_option("large_crop", "1"); }
else {
update_option("large_crop", "1");
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment