{"id":159237,"date":"2010-10-25T08:00:00","date_gmt":"2010-10-25T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/simple-thumbs\/"},"modified":"2011-07-13T05:44:00","modified_gmt":"2011-07-13T05:44:00","slug":"simple-thumbs","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/simple-thumbs\/","title":{"rendered":"Simple Thumbs"},"content":{"rendered":"<p>** This plugin will no longer be updated. **<\/p>\n<p>This plugin does three things:<\/p>\n<ol>\n<li>It creates rewrite rules that let you create nice urls for your images,<br \/>\nlike \u201chttp:\/\/example.com\/image\/55\/DSC_0001.jpg\u201d instead of \u201chttp:\/\/example.com\/wordpress\/\/www\/wwwroot\/img.feibisi.com\/2010\/02\/DSC_0001.jpg\u201d\u201d<\/li>\n<li>It let\u2019s you resize and crop images. And you can add unsharp filter to them too.<\/li>\n<li>It adds a function, simple_thumbs_img() and with this function you can create ready-to-go IMG-tags<br \/>\nthat outputs the correct width and height, even if you choose to resize or crop your image.<\/li>\n<\/ol>\n<h4>Rewrite Rules\/Nice Image URLs example<\/h4>\n<p>Instead of this URL:<br \/>\nhttp:\/\/example.com\/wordpress\/\/www\/wwwroot\/img.feibisi.com\/2010\/02\/DSC_0001.jpg<\/p>\n<p>Your image can have this URL, where 55 is the Attachment ID:<br \/>\nhttp:\/\/example.com\/image\/55\/DSC_0001.jpg<\/p>\n<p>Shorter and sweeter.<br \/>\nBut there\u2019s more! You can also send in some arguments:<\/p>\n<p>Resize the image to be 150px in width:<br \/>\n    http:\/\/example.com\/image\/55:w150\/DSC_0001.jpg<\/p>\n<p>Resize the image to be 150px in width, and give it another name (you can name the image to whatever you want)<br \/>\nhttp:\/\/example.com\/image\/55:w150\/my-cool-image.jpg<\/p>\n<p>Resize the image to 150px in height:<br \/>\nhttp:\/\/example.com\/image\/55:h150\/DSC_0001.jpg<\/p>\n<p>Resize the image to stay within 150px in height and width:<br \/>\nhttp:\/\/example.com\/image\/55:w150:h150\/DSC_0001.jpg<\/p>\n<p>Crop the image to exactly 150px in width and height:<br \/>\nhttp:\/\/example.com\/image\/55:w150:h150\/DSC_0001.jpg<\/p>\n<p>Make a small thumb, and also add an unsharp filter:<br \/>\nhttp:\/\/example.com\/image\/55:w175:h75:c1:u1\/DSC_0001.jpg<\/p>\n<p>Make a small thumb, and also add an unsharp filter, and output as png:<br \/>\nhttp:\/\/example.com\/image\/55:w175:h75:c1:u1:fp\/DSC_0001.jpg<\/p>\n<p>Same as above, but with pipe as the delimeter (you can choose between ,._- and |):<br \/>\nhttp:\/\/example.com\/image\/55|w175|h75|c1|u1|fp\/DSC_0001.jpg<\/p>\n<p>Please note that all the resize stuff where made without adding any querystring to the URL.<br \/>\nThis is good for Search Engine Optimization (SEO) reasones, but also for caching reasons.<br \/>\nGoogle Page Speed will for example give you a higher score because of this! \ud83d\ude42<\/p>\n<p>All generated images will be cached, so only the first call to each URL restults in an actual resize of the image.<br \/>\nImages are also sent with far future expires headers, so if a user returns to your page all images should load blazingly fast.<\/p>\n<h4>simple_thumbs_img(): The Magic Function<\/h4>\n<p>simple_thumbs_img() generates IMG tags for you, with the correct width & height attributes set, even after resize.<\/p>\n<p>With no width and height values set, the page may be redrawn several times, resulting in a very \u201cjumpy\u201d page.<br \/>\nUsing Simple Thumb to create your image tag will solve this problem.<\/p>\n<p>Lack of width and height atributes in img-tags can also lead to<br \/>\nerrors when JavaScript ondomready calculations are made while images are still loading, since<br \/>\nit can\u2019t determine the size of the image.<\/p>\n<pre><code>    <?php\n\n    \/\/ get img tag with nice url for image with id 55, with the correct width and height attributes set.\n    \/\/ do whatever you wan't with it\n    $img_src = simple_thumbs_img(\"id=55&tag=1\");\n\n    \/\/ print img tag with nice url for image with id 55, with the correct width and height attributes set.\n    echo simple_thumbs_img(\"id=55&tag=1\");\n\n    \/\/ print img tag with nice url for image with id 55, and resize it to be a thumb that has the max size 75x75,\n    \/\/ with the correct width and height attributes set.\n    echo simple_thumbs_img(\"id=55&tag=1&w=75&h=75\");\n\n    \/\/ print img tag with nice url for image with id 55, and crop it to be a thumb that has the excact size 75x75,\n    \/\/with the correct width and height attributes set, and add an alt text\n    echo simple_thumbs_img(\"id=55&tag=1&w=75&h=75&m=c&alt=My alternative text\");\n\n    ?>\n<\/code><\/pre>\n<h4>Resize modes<\/h4>\n<p>Control the way the thumbs are created by adding parameter \u201cm\u201d, as in \u201cmode\u201d.<br \/>\nTo learn how they work just experiment a bit.<\/p>\n<ul>\n<li>within = mw<\/li>\n<li>crop = mc<\/li>\n<li>portrait = mp<\/li>\n<li>landscape = ml<\/li>\n<li>auto = ma<\/li>\n<\/ul>\n<h4>Filters<\/h4>\n<ul>\n<li>unsharp mask \u2013 good for making small thumbnails appear to have more detail. Once you\u2019ve gone unsharp, you don\u2019t want to go back! \ud83d\ude42<br \/>\nu0 for note, u3 for sharpest<\/li>\n<\/ul>\n<h4>Donation and more plugins<\/h4>\n<ul>\n<li>If you like this plugin don\u2019t forget to <a href=\"http:\/\/example.com\/sida\/donate\/\" rel=\"nofollow ugc\">donate to support further development<\/a>.<\/li>\n<li>More <a href=\"https:\/\/wordpress.org\/extend\/plugins\/profile\/eskapism\" rel=\"ugc\">WordPress CMS plugins<\/a> by the same author.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Create image thumbs from WP attachments, w\/ option to crop &#038; fit to wanted size &#038;<br \/>\ncreate IMG-tags w\/ correct width &#038; height attributes.<\/p>\n","protected":false},"author":65,"featured_media":228704,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Simple Thumbs - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"Create image thumbs from WP attachments, w\/ option to crop & fit to wanted size & create IMG-tags w\/ correct width & height attributes."},"footnotes":""},"categories":[1],"tags":[26294,223,3916,2609,10590],"class_list":["post-159237","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-gd","tag-image","tag-photos","tag-thumbnails","tag-thumbs"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/159237","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=159237"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/159237\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/228704"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=159237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=159237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=159237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}