{"id":2174,"date":"2012-01-16T14:35:47","date_gmt":"2012-01-16T13:35:47","guid":{"rendered":"http:\/\/www.nivas.hr\/blog\/?p=2174"},"modified":"2012-01-16T17:01:32","modified_gmt":"2012-01-16T16:01:32","slug":"rim-php-remote-image-library","status":"publish","type":"post","link":"https:\/\/www.nivas.hr\/blog\/2012\/01\/16\/rim-php-remote-image-library\/","title":{"rendered":"rim &#8211; PHP Remote Image Library"},"content":{"rendered":"<p>Working on recent home project I found there is no library in PHP to get\u00a0dimensions\u00a0of remote images.<br \/>\nSo I made <a title=\"Remote Image Library\" href=\"https:\/\/github.com\/MatejB\/rim\" target=\"_blank\">rim\u00a0php library<\/a> to get type and size of remote images in optimized way.<!--more--><\/p>\n<p><a href=\"https:\/\/github.com\/MatejB\/rim\" target=\"_blank\"><strong>Fork it on github<\/strong><\/a><\/p>\n<p>The\u00a0easiest\u00a0way of getting a image dimension is by using\u00a0<a href=\"http:\/\/php.net\/manual\/en\/function.getimagesize.php\" target=\"_blank\">getimagesize<\/a> PHP function.<br \/>\nIt has one great fault when working with remote images, whole image must be\u00a0downloaded\u00a0in order for\u00a0getimagesize to read it&#8217;s\u00a0dimensions.<br \/>\nSo if you want to find out\u00a0dimensions\u00a0of jpeg 2MB in size\u00a0getimagesize will first download it. There goes bandwidth!<\/p>\n<p><em>Rim downloads only few byes need to\u00a0determine\u00a0image type and dimensions.<\/em><br \/>\nAlso if you need to get dimensions of lot&#8217;s of pictures <em>rim will thread fetch request<\/em> for\u00a0further\u00a0speed\u00a0increase.<\/p>\n<p>Take a look at this benchmark, fetching image types and sizes of all images on\u00a0<a href=\"http:\/\/www.amazon.com\/gp\/new-releases\/books\/ref=sv_b_2\">Hot New Releases in Books<\/a>\u00a0at amazon.com:<br \/>\n<img class=\"alignnone\" src=\"https:\/\/github.com\/MatejB\/rim\/raw\/master\/tests\/tests_resources\/performance.jpg\" alt=\"\" width=\"480\" \/><\/p>\n<p>Have fun!<\/p>\n<p>P.S.<br \/>\nBug reports would be appreciated ;)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working on recent home project I found there is no library in PHP to get\u00a0dimensions\u00a0of remote images. So I made rim\u00a0php library to get type and size of remote images in optimized way.<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,7],"tags":[],"_links":{"self":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/2174"}],"collection":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/comments?post=2174"}],"version-history":[{"count":31,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/2174\/revisions"}],"predecessor-version":[{"id":2205,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/posts\/2174\/revisions\/2205"}],"wp:attachment":[{"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/media?parent=2174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/categories?post=2174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nivas.hr\/blog\/wp-json\/wp\/v2\/tags?post=2174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}