magento2: Inconsistency in Fotorama.js lib or does magento2 use it's on version?

Preconditions (*)

  • A Magento 2.2.x/2.3.x instance with at least one product

Steps to reproduce (*)

  • Load any PDP
  • View the source of the fotorama.js file
  • Compare it with the same version 4.6.4 code downloaded from source (fotorama.io)

Expected result (*)

  • The version 4.6.4 fotorama.js file included by Magento2 should match the third party source file or explicitly state that it is a fork with modifications (suggest version number should also indicate this).

Actual result (*)

  • The Magento2 codebase contains a modified version of fotorama.js which has deviated from the source fotorama.js (resulting in missing functionality).

Original Issue Content

We had a project there we would like to show always a thumbnail on the product details page, even if there is only one picture. I’ve looked at the Fotorama Github and in the changelog i’ve found, that there is an option enableifsingleframe since version 4.6.2. I’ve implemented this and it did not worked. Then i’ve dived depper into the topic and have found we following code here:

https://github.com/artpolikarpov/fotorama/blob/master/src/js/fotorama.js#L268

if (size > 1 || opts.enableifsingleframe) {
 ...
}

and in magento i find this: https://github.com/magento/magento2/blob/2.3-develop/lib/web/fotorama/fotorama.js#L2096

if (size > 1) {
  ...
}

But as in the top command of fotorama (https://github.com/magento/magento2/blob/2.3-develop/lib/web/fotorama/fotorama.js#L2) it states out that magento should use fotorama version 4.6.4.

Now i’m a little bit confused. In theory magento is using the latest release of fotorama, but is missing some features which are implemented before 4.6.4.

Maybe some magento frontend guy can give me some insights how this can happen?

Thanks in regards!

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 3
  • Comments: 19 (9 by maintainers)

Most upvoted comments

Today I’ve read this. Now it’s even more important that this is cleared up. Even if it is only an official hint that the Magento core has made its own modifications to the library and the original docs does not match the functions in Magento.

https://twitter.com/fotoramajs/status/1088074531007127553?s=21:

Frontend news! Fotorama is back! Thanks to @Uploadcare, the project is maintained again! I’ll continue where I quit. First I’ll try to fix all known issues with v4 — this is for the army of Fotorama 4 users (≈148,685 live sites worldwide).

Hi, this doesn’t seem to be a “non-issue”.

The file magento2/lib/web/fotorama/fotorama.js appears to contain modified Fotorama.js third party library code under the guise of the same version number 4.6.4.

Preconditions:

  • A Magento 2.2.x/2.3.x instance with at least one product

Steps to reproduce:

  • Load any PDP
  • View the source of the fotorama.js file
  • Compare it with the same version 4.6.4 code downloaded from source (fotorama.io)

Expected Result:

  • The version 4.6.4 fotorama.js file included by Magento2 should match the third party source file or explicitly state that it is a fork with modifications (suggest version number should also indicate this).

Actual Result:

  • The Magento2 codebase contains a modified version of fotorama.js which has deviated from the source fotorama.js (resulting in missing functionality).

@lorenaramonda i’ve done the same, but it has took me quite some time to find the issue, why this does not work out of the box and i first had to patch fotorama.js.

I find it really annoying that there are third party libraries which are patched and there is no hint or something else in the code. Even the version number was never adjusted .