{"id":89257,"date":"2011-07-21T08:00:00","date_gmt":"2011-07-21T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/image-cropper\/"},"modified":"2011-07-21T22:49:00","modified_gmt":"2011-07-21T22:49:00","slug":"image-cropper","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/image-cropper\/","title":{"rendered":"Image Cropper"},"content":{"rendered":"<p>For cropping a post thumbnail image to 200\u00d7300 pixels:<\/p>\n<pre><code><?php\n    the_post();\n    img(200, 300);\n?>\n<\/code><\/pre>\n<p>This will verify the existence of post thumbnail, crop the image, save it in uploads folder, and generate an image tag.<\/p>\n<p>To verify the existence of a post thumbnail, you can use <code>has_img()<\/code><\/p>\n<pre><code><?php if (has_img()): ?>\n<figure>\n    <?php img(200, 300) ?>\n    <figcaption>Some text<\/figcaption>\n<\/figure>\n<?php endif ?>\n<\/code><\/pre>\n<p>To crop images that are not post thumbnails, you can use <code>crop($url, $size)<\/code><\/p>\n<pre><code><?php\n    $cropped_url= crop( get_bloginfo('url') . '\/\/www\/wwwroot\/img.feibisi.com\/image.jpg', array(200, 300) );\n?>\n<img decoding=\"async\" src=\"<?php echo $cropped_url ?>\">\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Image cropper gives you an API for cropping images inside WordPress.<\/p>\n","protected":false},"author":65,"featured_media":235251,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Image Cropper - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Image cropper gives you an API for cropping images inside WordPress."},"footnotes":""},"categories":[1],"tags":[461,26142,223],"class_list":["post-89257","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-api","tag-cropper","tag-image"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/89257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=89257"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/89257\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/235251"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=89257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=89257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=89257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}