Well, If the plugin stop working, is deactivated or removed all images will stop working and will appear php error everywhere. (is you are using fly_get_attachment_image for show all images or big part of all images of the site (my case)).
So I have created a ‘backup’ solution is the following:
on the function.php where I am declaring the thumb sizes:
if ( function_exists( 'fly_add_image_size' ) ) {
fly_add_image_size( 'grid-1-1', 300, 300, true );
fly_add_image_size( 'grid-1-2', 300, 600, true );
fly_add_image_size( 'grid-1-3', 300, 900, true );
fly_add_image_size( 'grid-2-1', 600, 300, true );
fly_add_image_size( 'grid-2-2', 600, 600, true );
fly_add_image_size( 'grid-2-3', 600, 900, true );
fly_add_image_size( 'grid-3-1', 900, 300, true );
fly_add_image_size( 'grid-3-2', 900, 600, true );
fly_add_image_size( 'grid-3-3', 900, 900, true );
} elseif (!function_exists( 'fly_add_image_size' )) {
add_image_size( 'grid-2-2', 600, 600, true );
}
and in the template where I am displaying the thumbs:
if (!function_exists( 'fly_add_image_size' )) {
the_post_thumbnail('grid-2-2');
} elseif ( $sizeGrid == $size1_1 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-1-1' );
} elseif ( $sizeGrid == $size1_2 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-1-2' );
} elseif ( $sizeGrid == $size1_3 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-1-3' );
} elseif ( $sizeGrid == $size2_1 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-2-1' );
} elseif ( $sizeGrid == $size2_2 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-2-2' );
} elseif ( $sizeGrid == $size2_3 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-2-3' );
} elseif ( $sizeGrid == $size3_1 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-3-1' );
} elseif ( $sizeGrid == $size3_2 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-3-2' );
} elseif ( $sizeGrid == $size3_3 ) {
echo fly_get_attachment_image( get_post_thumbnail_id(), 'grid-3-3' );
}
So in case the plugin is not working, deactivated or removed instead of showing errors everywhere and no images, I will display a thumb of 600x600px. That is much better than php errors and not images
if (!function_exists( 'fly_add_image_size' )) {
the_post_thumbnail('grid-2-2');
Also I could define more thumb sizes “add_image_size”, if the function “fly_add_image_size” doesn’t exist but in my case with one 600×600 it will be enough.
BTW: Probably there are many ways to do what I want to do, but at the moment this way is working on my project.
@junaidbhura Thanks for the plugins, It’s amazing, this should be a default functionality of WP.
Thanks