Jump to content
horst

Beta testers wanted: CroppableImage with WebP support

Recommended Posts

Hi all,

I'm searching for Alpha/Beta tester of the new rewritten Croppable Image module. I opened a new repo on Github, with the name CroppableImage4: https://github.com/horst-n/CroppableImage4

It is a rewrite of the CAI3. I dropped all internal image manipulations, to be more future safe. Now I delegate all this to the parent core image fields methods. To be able to do this, I need to change some things and the module is no longer backwards compatible.

A) For the alpha & beta testing, there is a new crop method name: $image->getCrop4(), this may be changed later to the legacy $image->getCrop() method. But for the testing period to avoid conflicts with CAI3, it is named getCrop4().  <- OBSOLETE, see the next post here in thread

B) With the first param, you pass the cropname into the method. Optionally you can pass image processing options as a second param, like with the core image field. To do this, you may use an array or a selector string.

C) You can use every known options param. Width, Height, Size is ignored! If you also want create WebPs in one go, please add "webpAdd" => true to the options array, (or webpAdd=1 to the options selector string)!

D) The resulting image variation names will differ from those of the previous version 3!

Please refer to the readme of the repo and, maybe compare it against the version 3, if you not already know it.

Thats it so far. I have tested it a bit in the last days and haven't found any issues. But it would be nice if some of you can test it too.

 

  • Like 8

Share this post


Link to post
Share on other sites

Hey,
I've made good progress. I think I have solved the issue for updating / changing from CAI3 to CAI4! 🙂

- So, if you want to use a CroppableImage field for a fresh new site, simply go directly with CroppableImage4! (once it is officially released)

- And if you have the CroppableImage3 on an existing site, but want to upgrade to CroppableImage4, (because you need WebP support), follow these easy steps:

  • First update CroppableImage3 to the latest version 1.2.0!
     
  • After that, additionally install CroppableImage4.
     
  • Now you can use both modules with the same ->getCrop() method call on pageimages. The getCrop hook "knows" from which field and module version it comes. 🙂
     
  • Therefore, from now on, you are free to start using CAI4 for new created template calls to CAI4 fields, while the older CAI3 calls can stay in and are fully functional without any changes.
     
  • If you want to switch CAI3 fields to CAI4 fields, to benefit from the new functionalities, you can do that in the
    admin > setup > fields > YOURFIELDNAME editor, by changing the (field) type. (see screenshot beneath, & yes, KEEP SETTINGS!)

     
  • The only thing you have to check, before doing that, is: looking into your templates code, if you have made use of the optional second param in the old CAI3 ->getCrop() calls. If no, what I think is 99.9% the case, you have to do nothing. If you make use of it, you need to change / adapt your method call in the template file.
     
  • That's it.
     

Summary:

  1. update CAI3
  2. install CAI4
  3. change the fieldtype(s) from CAI3 to CAI4

 

When I've got some feedback from beta testers (and everything works out as expected) I will release the CAI4 through the modules directory. Until then, you get the RC2 version of it on GitHub: https://github.com/horst-n/CroppableImage4

 

cai3-to-cai4.png.8ff2d58415d6903c04267de787853343.png

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @horst!

When saving Crop Settings with MAMP i get (square,200,200 for example) .

DB connect error 2006 - MySQL server has gone away

Everything else seems fine when saving.

  • Like 1

Share this post


Link to post
Share on other sites
48 minutes ago, Mats said:

Hi @horst!

When saving Crop Settings with MAMP i get (square,200,200 for example) .


DB connect error 2006 - MySQL server has gone away

Everything else seems fine when saving.

Hey Mats, thanks for testing.

I tested saving of different Crop Settings and also edited and or removed them later without issues. So, cannot reproduce. 

Have you tested it locally or on a online server?

Have you used CAI4 alone, or is CAI3 also installed there when you tested?

You mean, you are not able to store any settings, never? Or occurred the issue occasionally?

Share this post


Link to post
Share on other sites

@Mats, please can you verify that you are using the latest version of CAI3 that is: 1.2.0 ??

If you have used an automated update service, it potentially stuck with version 1.1.18. I now manually updated the record in the modules directory to 1.2.0! 

Share this post


Link to post
Share on other sites

Tested on local installation on MAMP.

No previous CroppableImage module installed.

I get the error only when trying to save with Crop Settings otherwise it saves as expected. 

Downloaded the module here: https://github.com/horst-n/CroppableImage4

 

Share this post


Link to post
Share on other sites

You mean, you cannot save a crop setting, only other field settings? So your cropsettings inputfield stays empty all the time?

Which PW version?

(I will try to reproduce.)

Share this post


Link to post
Share on other sites

Can't save Crop Settings (square,200,200 for example). Other settings saves.

ProcessWire 3.0.152 dev 

Share this post


Link to post
Share on other sites

@Mats I downloaded and installed the latest PW dev version with a blank profile, added the CAI4 module, created a new image filed and saved a crop setting "square,200,200" successfully.

Everything in this regard is working fine here. I can't reproduce!

Also nothing in regard of the cropsettings inputfield and its processing have changed, compared to the other versions that are in use for many years.??

Share this post


Link to post
Share on other sites

Perhaps a MAMP thing then. 

Share this post


Link to post
Share on other sites

Tested on another MAMP installation and it works as expected there. 

  • Like 1

Share this post


Link to post
Share on other sites

My short feedback: I have gradually changed everything from CAI3 to CAI4 2.0.0-RC02 (8 websites). Everything is going well so far.
Strangely enough I sometimes had to click 2x save in  the field settings when switching fields to V4 to avoid error messages there.
And of course the server works hard when recalculating the images.
Otherwise, I didn't notice anything else. The update instructions and the procedure were exemplary.

  • Thanks 1

Share this post


Link to post
Share on other sites
2 hours ago, ceberlin said:

My short feedback: I have gradually changed everything from CAI3 to CAI4 2.0.0-RC02 (8 websites). Everything is going well so far.
Strangely enough I sometimes had to click 2x save in  the field settings when switching fields to V4 to avoid error messages there.
And of course the server works hard when recalculating the images.
Otherwise, I didn't notice anything else. The update instructions and the procedure were exemplary.

@ceberlin Many thanks for testing and providing feedback! 👍

Good to hear that you successfully switched 8 websites from v3 to v4.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...