Skip to content

Commit

Permalink
added ability to return null from thumbnailPath function to revert to…
Browse files Browse the repository at this point in the history
… default handling
  • Loading branch information
ericnewton76 committed Apr 8, 2022
1 parent c855b1b commit e409858
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/js/justifiedGallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,19 @@ JustifiedGallery.prototype.getUsedSuffix = function (str) {
* @returns {String} the suffix to use
*/
JustifiedGallery.prototype.newSrc = function (imageSrc, imgWidth, imgHeight, image) {
var newImageSrc;
var newImageSrc = null;

if (this.settings.thumbnailPath) {
newImageSrc = this.settings.thumbnailPath(imageSrc, imgWidth, imgHeight, image);
} else {

if (newImageSrc == null) {

var matchRes = imageSrc.match(this.settings.extension);
var ext = (matchRes !== null) ? matchRes[0] : '';
newImageSrc = imageSrc.replace(this.settings.extension, '');
newImageSrc = this.removeSuffix(newImageSrc, this.getUsedSuffix(newImageSrc));
newImageSrc += this.getSuffix(imgWidth, imgHeight) + ext;

}

return newImageSrc;
Expand Down

0 comments on commit e409858

Please # to comment.