Skip to content

Add hookable method to newly created variation to PageImage.php #223

@karltdev

Description

@karltdev

Short description of the enhancement

I would like to suggest adding hookable method for newly created variation to PageImage.php. Right now the hooksable size() method is checking the existence of the variation. When the variation is not exist, a new variation is created by sizer. This could be a separated method that creates the variation after checking the existence.

existing: size(check existence > if true create variation and save the variation to files )
improved: size(check existence) > if true > createVariation(standardized method)

Why would the enhancement be useful to users?

A standardized method for creating image variation can benefit future modules. Developers can use the method directly to create image variation by passing needed parameters for crop and resize.

I am forking AmazonS3Cloudfront module and making it more robust for AWS ecosystem as it can make Processwire a stateless webserver easily. What I need to handle are the creation and removal of the files and images which have to be doing the same in AWS S3.

There is a missing piece for the module to handle the creation of new image variation. I have tried to hook the size() method directly and upload the image no matter the the PageImage is newly created or not. However, it takes a second for one image. A method that is solely for variation creation can greatly reduce the loading time as it executes only when a new variation is created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions