junaidbhura / fly-dynamic-image-resizer

Fly Dynamic Image Resizer plugin for WordPress
https://wordpress.org/plugins/fly-dynamic-image-resizer/
MIT License
162 stars 26 forks source link

Bedrock Compatibility #23

Open chicharitomagnetico opened 5 years ago

chicharitomagnetico commented 5 years ago

Would it be possible to make the plugin work with Bedrock? https://roots.io/bedrock/docs/bedrock-compatibility/

junaidbhura commented 5 years ago

Hi @chicharitomagnetico it should work with any WordPress architecture, as long as the images are available locally to the plugin.

Does it not work now? If not, what exactly is the problem?

chicharitomagnetico commented 5 years ago

It seems that the plugin it's not creating the cropped image. I changed the path of the image folder, and the plugin created the folder on the uploads folder. The folder has the proper permissions but it doesn't contain images.

/Users/alderaan/playus/wordpress_dev/playus_site_16/playus-wp/bedrock/web/app/uploads/playus-images Writeable!

When I check the images folder, it's empty. This doesn't happen with normal architecture.

junaidbhura commented 5 years ago

I think you might have to change the directory where this plugin stores and looks for images. You might need to use the fly_dir_path hook. Something like:

/**
 * Update Fly Images directory.
 *
 * @param string  $path
 * @return string
 */
function my_fly_dir_path( $path = '' ) {
    return '/Users/alderaan/playus/wordpress_dev/playus_site_16/playus-wp/bedrock/web/app/uploads/fly-images';
}
add_filter( 'fly_dir_path', 'my_fly_dir_path' );

More info here: https://github.com/junaidbhura/fly-dynamic-image-resizer/wiki/Actions-&-Filters

chicharitomagnetico commented 5 years ago

I moved the folder using:

/*-------------------------------------------------------------------------------------*/
/* Change Fly Images Path
/*-------------------------------------------------------------------------------------*/
function change_fly_path( $path = '' ) {
    require_once(ABSPATH . 'wp-admin/includes/file.php');
    $absolute = get_home_path();
    return $absolute.'app/uploads/playus-images';
}
add_filter( 'fly_dir_path', 'change_fly_path' );
//////////////////////////////

The plugin created the folder but it's not creating the cropped images.

junaidbhura commented 5 years ago

@chicharitomagnetico I've fixed this on another branch: https://github.com/junaidbhura/fly-dynamic-image-resizer/tree/fly-dir-path

Could you please test and let me know if it's all okay? If it is, I'll merge it in and release a new version of this plugin.

chicharitomagnetico commented 5 years ago

Hola @junaidbhura I tested the branch with the same results, still not working. I tested it on another environment (not Bedrock) and it works ok.

junaidbhura commented 5 years ago

Hey @chicharitomagnetico I just checked with Bedrock, and it does seem to work okay.

Can you try removing the filter fly_dir_path and trying again?

chicharitomagnetico commented 4 years ago

Sorry, I finished the project with another solution, but now that I have a little time I want to make it work. I used the branch you created, it is creating the files, but now when I use fly_get_attachment_image_src it returns a URL like this one www.localsite.com/Users/alderaan/playus/wordpress_dev/bellybus/bedrock/web/app/uploads/fly-images/12/belly-bus-food-trucks-800x588-c.png