{"id":39158,"date":"2015-09-30T12:16:34","date_gmt":"2015-09-30T12:16:34","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/fly-dynamic-image-resizer\/"},"modified":"2023-08-12T07:50:47","modified_gmt":"2023-08-12T07:50:47","slug":"fly-dynamic-image-resizer","status":"closed","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/fly-dynamic-image-resizer\/","author":10345926,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"2.0.8","stable_tag":"2.0.8","tested":"6.3.8","requires":"3.0","requires_php":"5.6","requires_plugins":null,"header_name":"Fly Dynamic Image Resizer","header_author":"Junaid Bhura","header_description":"","assets_banners_color":"69b291","last_updated":"2023-08-12 07:50:47","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/junaid.dev","rating":4.6,"author_block_rating":0,"active_installs":5000,"downloads":107329,"num_ratings":0,"support_threads":2,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"junaidbhura","date":"2015-09-30 13:32:34"},"1.0.1":{"tag":"1.0.1","author":"junaidbhura","date":"2015-11-23 10:56:51"},"1.0.2":{"tag":"1.0.2","author":"junaidbhura","date":"2016-12-09 05:36:58"},"1.0.3":{"tag":"1.0.3","author":"junaidbhura","date":"2017-01-03 12:02:47"},"1.0.4":{"tag":"1.0.4","author":"junaidbhura","date":"2017-02-16 08:32:01"},"1.0.5":{"tag":"1.0.5","author":"junaidbhura","date":"2017-06-05 07:21:43"},"2.0.0":{"tag":"2.0.0","author":"junaidbhura","date":"2017-09-18 05:02:39"},"2.0.1":{"tag":"2.0.1","author":"junaidbhura","date":"2017-09-21 12:06:17"},"2.0.2":{"tag":"2.0.2","author":"junaidbhura","date":"2017-10-09 03:13:29"},"2.0.3":{"tag":"2.0.3","author":"junaidbhura","date":"2017-11-09 06:14:14"},"2.0.4":{"tag":"2.0.4","author":"junaidbhura","date":"2017-11-12 23:17:10"},"2.0.5":{"tag":"2.0.5","author":"junaidbhura","date":"2020-03-28 03:11:31"},"2.0.6":{"tag":"2.0.6","author":"junaidbhura","date":"2020-06-27 03:03:15"},"2.0.7":{"tag":"2.0.7","author":"junaidbhura","date":"2021-03-09 07:35:27"},"2.0.8":{"tag":"2.0.8","author":"junaidbhura","date":"2023-08-12 07:50:47"}},"upgrade_notice":[],"ratings":{"1":2,"2":0,"3":0,"4":1,"5":19},"assets_icons":{"icon-256x256.png":{"filename":"icon-256x256.png","revision":1256617,"resolution":"256x256","location":"assets","locale":""},"icon-64x64.png":{"filename":"icon-64x64.png","revision":1282411,"resolution":"64x64","location":"assets","locale":""}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":1256606,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.png":{"filename":"banner-772x250.png","revision":1256606,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","2.0.0","2.0.1","2.0.2","2.0.3","2.0.4","2.0.5","2.0.6","2.0.7","2.0.8"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":2952545,"resolution":"1","location":"plugin"},"screenshot-2.png":{"filename":"screenshot-2.png","revision":2952545,"resolution":"2","location":"plugin"}},"screenshots":{"1":"The Tools page","2":"Delete individual images' cached fly images"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1506,163,233,30343,2703],"plugin_category":[50],"plugin_contributors":[85440],"plugin_business_model":[],"class_list":["post-39158","plugin","type-plugin","status-closed","hentry","plugin_tags-dynamic","plugin_tags-images","plugin_tags-media-library","plugin_tags-on-the-fly","plugin_tags-resize","plugin_category-media","plugin_contributors-junaidbhura","plugin_committers-junaidbhura"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/fly-dynamic-image-resizer_69b291.svg","icon_2x":false,"generated":true},"screenshots":[{"src":"https:\/\/ps.w.org\/fly-dynamic-image-resizer\/trunk\/screenshot-1.png?rev=2952545","caption":"The Tools page"},{"src":"https:\/\/ps.w.org\/fly-dynamic-image-resizer\/trunk\/screenshot-2.png?rev=2952545","caption":"Delete individual images' cached fly images"}],"raw_content":"<!--section=description-->\n<p><a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\">Check out the Github Repository \u2665<\/a><\/p>\n\n<p>One of the biggest problems theme developers face is the problem of multiple image sizes. When you upload an image in the media library, WordPress automatically creates thumbnails based on <strong>all the image sizes<\/strong> you have defined using <strong><code>add_image_size()<\/code><\/strong> whether you want to use them or not. So the vast majority of the images in wp-content\/uploads directory <strong>are a waste, and are never used.<\/strong> This is not the optimum way of creating image sizes.<\/p>\n\n<p>With this plugin, you can create <strong>as many image sizes as you want<\/strong> without the guilt of unnecessary image sizes taking up your disk space!<\/p>\n\n<p>This is because the images created using this plugin are dynamically created when the image is called for the <strong>first time<\/strong>, rather than when it is uploaded. You can also delete the cached images for each image individually, or all the cached images.<\/p>\n\n<h4>How this plugin works<\/h4>\n\n<ol>\n<li>You either define an image size in your code using the <strong><code>fly_add_image_size()<\/code><\/strong> function, or directly call the image size in the code<\/li>\n<li>The admin uploads the image in the media library, but the fly dynamic images are not created<\/li>\n<li>The user visits the page for the first time, and the image is dynamically created and is stored<\/li>\n<li>The user visits the page again for the second time, and the stored version of the image is served<\/li>\n<\/ol>\n\n<h4>Documentation<\/h4>\n\n<p>Here are some functions and example code to get you started!<\/p>\n\n<p><strong>fly_get_attachment_image_src( $attachment_id, $size, $crop )<\/strong><\/p>\n\n<ul>\n<li><strong>attachment_id<\/strong> (integer)(required) : The ID of the image attachment<\/li>\n<li><strong>size<\/strong> (string\/array)(required) : Either the name of the pre-defined size defined using <code>fly_add_image_size<\/code>, or an array with the width and height. Ex: array( 500, 500 )<\/li>\n<li><strong>crop<\/strong> (boolean\/array)(optional) : Whether the image should be cropped, or the crop position<\/li>\n<\/ul>\n\n<p>Returns an array:<\/p>\n\n<pre><code>array(\n    'src' =&gt; string,\n    'width' =&gt; integer,\n    'height' =&gt; integer\n)\n<\/code><\/pre>\n\n<p>&nbsp;<\/p>\n\n<p><strong>fly_get_attachment_image( $attachment_id, $size, $crop, $attr )<\/strong><\/p>\n\n<ul>\n<li><strong>attachment_id<\/strong> (integer)(required) : The ID of the image attachment<\/li>\n<li><strong>size<\/strong> (string\/array)(required) : Either the name of the pre-defined size defined using <code>fly_add_image_size<\/code>, or an array with the width and height. Ex: array( 500, 500 )<\/li>\n<li><strong>crop<\/strong> (boolean\/array)(optional) : Whether the image should be cropped, or the crop position<\/li>\n<li><strong>attr<\/strong> (array)(optional) : An array of attributes. Ex: <code>array( 'alt' =&gt; 'Alt text', 'title' =&gt; 'Title text', 'class' =&gt; 'my-class', 'id' =&gt; 'my-id' )<\/code><\/li>\n<\/ul>\n\n<p>Returns a HTML IMG element string:<\/p>\n\n<pre><code>&lt;img src=\"http:\/\/yoursite.com\/wp-content\/uploads\/fly-images\/10\/your-image-500x500-c.jpg\" width=\"500\" height=\"500\" alt=\"Alt text\" \/&gt;\n<\/code><\/pre>\n\n<p>&nbsp;<\/p>\n\n<h4>Example 1: Pre-defined Image Sizes<\/h4>\n\n<p>In this method, you define as many image sizes as you want in your <strong>functions.php<\/strong> file.<\/p>\n\n<pre><code>if ( function_exists( 'fly_add_image_size' ) ) {\n    fly_add_image_size( 'home_page_square', 500, 500, true );\n    fly_add_image_size( 'home_page_square_2x', 1000, 1000, true );\n    fly_add_image_size( 'cropped_top_left', 1000, 1000, array( 'left', 'top' ) );\n}\n<\/code><\/pre>\n\n<p>Now, lets get the post thumbnail using the image sizes we just defined:<\/p>\n\n<pre><code>&lt;?php echo fly_get_attachment_image( get_post_thumbnail_id(), 'home_page_square' ); ?&gt;\n<\/code><\/pre>\n\n<p>Here's another way you can do this:<\/p>\n\n<pre><code>&lt;?php $image = fly_get_attachment_image_src( get_post_thumbnail_id(), 'home_page_square' ); echo '&lt;img src=\"' . $image['src'] . '\" width=\"' . $image['width'] . '\" height=\"' . $image['height'] . '\" \/&gt;'; ?&gt;\n<\/code><\/pre>\n\n<p>Let's get the image from our example above which has a crop position defined:<\/p>\n\n<pre><code>&lt;?php echo fly_get_attachment_image( get_post_thumbnail_id(), 'cropped_top_left' ); ?&gt;\n<\/code><\/pre>\n\n<p>&nbsp;<\/p>\n\n<h4>Example 2: Dynamic Image Sizes<\/h4>\n\n<p>Lets get the post thumbnail using some dynamic image sizes:<\/p>\n\n<pre><code>&lt;?php echo fly_get_attachment_image( get_post_thumbnail_id(), array( 500, 500 ), true ); ?&gt;\n<\/code><\/pre>\n\n<p>Here's another way you can do this:<\/p>\n\n<pre><code>&lt;?php $image = fly_get_attachment_image_src( get_post_thumbnail_id(), 'home_page_square', array( 500, 500 ), true ); echo '&lt;img src=\"' . $image['src'] . '\" width=\"' . $image['width'] . '\" height=\"' . $image['height'] . '\" \/&gt;'; ?&gt;\n<\/code><\/pre>\n\n<p>Lets get the post thumbnail cropped from the bottom right:<\/p>\n\n<pre><code>&lt;?php echo fly_get_attachment_image( get_post_thumbnail_id(), array( 500, 500 ), array( 'right', 'bottom' ) ); ?&gt;\n<\/code><\/pre>\n\n<p>&nbsp;<\/p>\n\n<h4>A note on Crop Positions<\/h4>\n\n<p>Crop positions are set using an array. The first parameter of the array needs to be the x-axis crop and the second parameter needs to be the y-axis crop. This feature <strong>will not<\/strong> work the other way around.<\/p>\n\n<p>For example:<\/p>\n\n<p>\u2713 <code>fly_get_attachment_image( get_post_thumbnail_id(), array( 500, 500 ), array( 'right', 'bottom' ) )<\/code> Will work! :)<\/p>\n\n<p>\u2718 <code>fly_get_attachment_image( get_post_thumbnail_id(), array( 500, 500 ), array( 'bottom', 'right' ) )<\/code> Will not work! :(<\/p>\n\n<h4>Detailed Documentation<\/h4>\n\n<p>Check out the GitHub repository's Wiki page for the full documentation: <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/wiki\">https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/wiki<\/a><\/p>\n\n<!--section=installation-->\n<p>Upload 'fly-dynamic-image-resizer' to the '\/wp-content\/plugins\/' directory<\/p>\n\n<p>Activate the plugin through the 'Plugins' menu in WordPress<\/p>\n\n<p>Create dynamic image sizes in your PHP code!<\/p>\n\n<!--section=changelog-->\n<h4>2.0.8<\/h4>\n\n<ul>\n<li>Fix error for WP_Filesystem in some edge cases <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/40\">#38<\/a><\/li>\n<\/ul>\n\n<h4>2.0.7<\/h4>\n\n<ul>\n<li>Fix file extensions in edge cases <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/38\">#38<\/a><\/li>\n<\/ul>\n\n<h4>2.0.6<\/h4>\n\n<ul>\n<li>New filter to potentially modify image path to work better with optimization plugins <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/33\">#33<\/a><\/li>\n<\/ul>\n\n<h4>2.0.5<\/h4>\n\n<ul>\n<li>Better multi-site support <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/19\">#19<\/a><\/li>\n<\/ul>\n\n<h4>2.0.4<\/h4>\n\n<ul>\n<li>Performance improvements <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/15\">#15<\/a><\/li>\n<\/ul>\n\n<h4>2.0.3<\/h4>\n\n<ul>\n<li>Added two new helper functions to get previously defined image sizes <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/14\">#14<\/a><\/li>\n<\/ul>\n\n<h4>2.0.2<\/h4>\n\n<ul>\n<li>Better handling of file names with decimals <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/issues\/10\">#10<\/a><\/li>\n<\/ul>\n\n<h4>2.0.1<\/h4>\n\n<ul>\n<li>Removed image optimization <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/releases\/tag\/2.0.1\">https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/releases\/tag\/2.0.1<\/a><\/li>\n<\/ul>\n\n<h4>2.0.0<\/h4>\n\n<ul>\n<li>Complete re-factor of the plugin using better coding practices, standards and unit tests.<\/li>\n<li>Image optimization has finally arrived - sort of. You'll still need to install the utilities on your server before it can start working. More info <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/wiki\/Optimization\">here<\/a>.<\/li>\n<li>New WP CLI commands to manipulate Fly images. More info <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/wiki\/WP-CLI\">here<\/a>.<\/li>\n<li>Full release details: <a href=\"https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/releases\/tag\/2.0.0\">https:\/\/github.com\/junaidbhura\/fly-dynamic-image-resizer\/releases\/tag\/2.0.0<\/a><\/li>\n<\/ul>\n\n<h4>1.0.5<\/h4>\n\n<ul>\n<li>Added support for crop positions. Images can now be cropped from the top, left, right, bottom or the default: center.<\/li>\n<li>Added new hook 'fly_image_created'.<\/li>\n<\/ul>\n\n<h4>1.0.4<\/h4>\n\n<ul>\n<li>Check for an error in get_attachment_image_src() . Props <a href=\"https:\/\/github.com\/christopherrolfe198\">christopherrolfe198<\/a>.<\/li>\n<\/ul>\n\n<h4>1.0.3<\/h4>\n\n<ul>\n<li>Added new filter 'fly_dir_path'.<\/li>\n<\/ul>\n\n<h4>1.0.2<\/h4>\n\n<ul>\n<li>Fixed IIS URLs.<\/li>\n<\/ul>\n\n<h4>1.0.1<\/h4>\n\n<ul>\n<li>Fixed user capabilities.<\/li>\n<li>\"Full\" size for fly_get_attachment_image_src now returns wp_get_attachment_image_src<\/li>\n<\/ul>\n\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>First stable release.<\/li>\n<\/ul>","raw_excerpt":"Dynamically create image sizes on the fly!","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/39158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=39158"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/junaidbhura"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=39158"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=39158"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=39158"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=39158"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=39158"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=39158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}