Skip to content

Transformations keep_frame is not working [bug] #105

@emogerov

Description

@emogerov

Hello,

I noticed a bug when compiling image urls in Plugin/Catalog/Block/Product/ImageFactory.php(I think it's the same for Model as well) plugin.

At line 223 function createTransformation it checks if (isset($imageMiscParams['keep_frame'])) and then $this->keepFrame = ($imageMiscParams['keep_frame'] === 'frame') ? true : false;

private function createTransformation(array $imageMiscParams)

$dimensions = $this->getDimensions($imageMiscParams);
$transform = $this->configuration->getDefaultTransformation()->withDimensions($dimensions);

if (isset($imageMiscParams['keep_frame'])) {
    $this->keepFrame = ($imageMiscParams['keep_frame'] === 'frame') ? true : false;
}

if ($this->keepFrame) {
    $transform->withCrop(Crop::lpad())
        ->withDimensions(Dimensions::squareMissingDimension($dimensions));
} else {
    $transform->withCrop(Crop::limit());
}

return $transform;

However! in magento default settings "keep_frame" can only be true or false and not "frame", therefore => $this->keepFrame = false; which results in url being with c_limit rather than c_lpad:
https://res-3.cloudinary.com/dltuverpp/image/upload/c_limit,dpr_2.0,f_auto,h_260,q_auto,w_260/v1/media/catalog/product/1/_/1_26.jpg

Am I missing something. How to configure url to be with c_pad/c_lpad and is it safe to extended the file and override it with what I assume is the correct code line?

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