Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #17432 from Wikia/popular-pages-smart-crop
Browse files Browse the repository at this point in the history
IW | Smart crop in popular pages rail module
  • Loading branch information
swietlana authored Aug 30, 2019
2 parents 19e0819 + e665d39 commit d60c2d3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extensions/wikia/Recirculation/RailContentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function renderRailModule() {
try {
$articles[$pageId]['thumbnail'] =
VignetteRequest::fromUrl( $article['thumbnail'] )
->zoomCrop()
->smart()
->width( static::RAIL_THUMBNAIL_WIDTH )
->height( static::RAIL_THUMBNAIL_HEIGHT )
->url();
Expand Down
2 changes: 1 addition & 1 deletion extensions/wikia/Recirculation/js/recirculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ require([

if (sponsoredItem.thumbnailUrl && window.Vignette) {
sponsoredItem.thumbnailUrl = window.Vignette.getThumbURL(sponsoredItem.thumbnailUrl, {
mode: window.Vignette.mode.zoomCrop,
mode: window.Vignette.mode.smart,
height: 53,
width: 53
});
Expand Down
6 changes: 6 additions & 0 deletions lib/Wikia/src/Vignette/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class UrlGenerator {
const MODE_WINDOW_CROP_FIXED = 'window-crop-fixed';
const MODE_ZOOM_CROP = 'zoom-crop';
const MODE_ZOOM_CROP_DOWN = 'zoom-crop-down';
const MODE_SMART = 'smart';


const IMAGE_TYPE_AVATAR = 'avatars';
const IMAGE_TYPE_IMAGES = 'images';
Expand Down Expand Up @@ -243,6 +245,10 @@ public function windowCropFixed() {
return $this->mode(self::MODE_WINDOW_CROP_FIXED);
}

public function smart() {
return $this->mode( self::MODE_SMART );
}

/**
* Force the thumbnail request to replace the cached thumbnail.
*
Expand Down
1 change: 1 addition & 0 deletions resources/wikia/libraries/vignette/vignette.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ var Vignette = (function () {
fixedAspectRatio: 'fixed-aspect-ratio',
fixedAspectRatioDown: 'fixed-aspect-ratio-down',
scaleToWidth: 'scale-to-width',
smart: 'smart',
thumbnail: 'thumbnail',
thumbnailDown: 'thumbnail-down',
topCrop: 'top-crop',
Expand Down

0 comments on commit d60c2d3

Please sign in to comment.