Skip to content

Commit 5ba26e0

Browse files
committed
Add smart cropping independent of resize, to accomodate cases when the resize is set from the js lib. fix https://secure.helpscout.net/conversation/3109320210/474190?viewId=2353196
1 parent 711a9f1 commit 5ba26e0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/url_replacer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ private function normalize_image( $url, $original_url, $args, $is_uploaded = fal
267267

268268
if ( ! empty( $args['resize'] ) ) {
269269
$this->apply_resize( $image, $args['resize'] );
270+
} elseif ( $this->settings->is_smart_cropping() ) {
271+
// If smart cropping is enabled and no resize is set, we apply smart focus since the resize can be triggered from the JS library.
272+
$image->smartFocus();
270273
}
271274

272275
if ( apply_filters( 'optml_apply_watermark_for', true, $url ) ) {

0 commit comments

Comments
 (0)