[1.0.x] Image Compare Accessible Slider

Created on 14 May 2024, about 1 month ago
Updated 12 June 2024, 14 days ago

This module provides a new formatter for image fields using the Image Compare javascript library (https://github.com/cloudfour/image-compare).

The main point of interest of this javascript library is the use of a simple HTML input element of type range to implement the slider.

This makes it one of the most accessible image comparison slider available at the moment.

Mandatory screenshot

Project link

https://www.drupal.org/project/image_compare โ†’

๐Ÿ“Œ Task
Status

Fixed

Component

module

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance mably

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mably
  • Status changed to Needs review about 1 month ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect โ†’ for more details and Security advisory coverage application checklist โ†’ to understand what reviewers look for. Tips for ensuring a smooth review โ†’ gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications โ†’ , Application workflow โ†’ , What to cover in an application review โ†’ , and Tools to use for reviews โ†’ .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool โ†’ only once per application.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues โ†’ .

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai
  • Status changed to Needs work about 1 month ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    I did not make a full review, but there is something that needs correct before proceeding with a deeper review.

    Projects hosted on drupal.org are licensed under GPLv2+, the same license used from Drupal core. If you are licensing a project under a different license, it cannot he hosted on drupal.org. More details are given in Drupal Git Contributor Agreement & Repository Usage Policy โ†’ .

    All code that is a derivative work of Drupal (typically PHP code, including but not limited to: core patches, modules, themes, etc) committed to Drupal.org's git repository is licensed as GPL version 2.0 and later (official short identifier: โ€œGPL-2.0-or-laterโ€). This means that the code is licensed under GPLv2, and there exists an option that allows downstream recipients to re-license the code to be under a later version of GPL.

    All code submitted to the repository that is a derivative work of Drupal must be and it will automatically be redistributed as GPL-2.0-or-later.

    Any code that is not GPL-2.0-or-later compatible or granted an exception by the LWG should not be added to the repository and when found will be removed.

    See also If I write a module or theme, do I have to license it under the GPL? โ†’

    Yes. Drupal modules and themes are a derivative work of Drupal. If you distribute them, you must do so under the terms of the GPL version 2 or later. You are not required to distribute them at all, however.

    For code licensed under GPLv3, see I want to release my work under GPL version 3 or under GPL version 2-only. Can I do so and host it on Drupal.org? โ†’

    No. You can release your work under any GPL version 2 or later compatible license. However, you may only check it into Drupal's Git repositories if you are releasing it under the same license as Drupal itself, that is GPL version 2 or later, allowing users to choose between the terms of the GPL version 2 or the terms in any new versions as updated by the FSF. If you are unable or unwilling to do so, do not check it into a Drupal Git repository.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Do you mean that the GNU AFFERO GENERAL PUBLIC LICENSE v3 is not an allowed licence? I thought it was.

    No problem to change it to basic GPL v3 if required.

    Thanks for your help.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Not even GPLv3 is allowed for a project hosted on drupal.org. That is what the text I quoted says.

    No. You can release your work under any GPL version 2 or later compatible license. However, you may only check it into Drupal's Git repositories if you are releasing it under the same license as Drupal itself, that is GPL version 2 or later, allowing users to choose between the terms of the GPL version 2 or the terms in any new versions as updated by the FSF. If you are unable or unwilling to do so, do not check it into a Drupal Git repository.

    ( I want to release my work under GPL version 3 or under GPL version 2-only. Can I do so and host it on Drupal.org? โ†’ )

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Ok, switched to the GPLv2 license taken directly from the Drupal sources.

  • Status changed to Needs review about 1 month ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably
  • Status changed to Needs work about 1 month ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    FILE: composer.json

    "license": "AGPL-3.0+",

    Update license as per LICENSE file.

  • Status changed to Needs review about 1 month ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Fixes have been pushed, thanks.

  • Status changed to RTBC about 1 month ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia vishal.kadam Mumbai

    Rest looks fine to me.

    Letโ€™s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

  • Status changed to Needs work 14 days ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
    • The following points are just a start and don't necessarily encompass all of the changes that may be necessary
    • A specific point may just be an example and may apply in other places
    • A review is about code that doesn't follow the coding standards, contains possible security issue, or does not correctly use the Drupal API; the single points are not ordered, not even by importance

    src/Plugin/Field/FieldFormatter/ImageCompareSliderFormatter.php

    Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter is not part of the public API, since it is a plugin implementation, and cannot be used as parent class. Only the classes that are marked with the @api tag, or base classes like FormatterBase, can be used.

        catch (\Exception $e) {
          $this->loggerFactory->get('image_compare')->warning($e->getMessage());
          return NULL;
        }
    

    The first argument passed to error(), warning(), and similar logger methods must be a literal string.

    To log exceptions, there is watchdog_exception() or the class method described in that documentation page.

    assets/vendor/image-compare/dist

    Files available from other repositories should not be committed on drupal.org. Instead, the module should document which files must be downloaded from other repositories, and where they should be placed.

  • Status changed to Needs review 14 days ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Hi @paderno, thanks for your review.

    Only the classes that are marked with the @api tag, or base classes like FormatterBase, can be used.

    If I understand it correctly, it should be ok to derive from the the base class ImageFormatterBase, can you confirm that?

    The first argument passed to error(), warning(), and similar logger methods must be a literal string.

    $e->getMessage() seems to return a string literal, so I'm not sure to understand what the problem was exactly.

    Anyway, I replaced everything with Error::logException, it's probably better to have the full stack trace in watchdog.

    Files available from other repositories should not be committed on drupal.org. Instead, the module should document which files must be downloaded from other repositories, and where they should be placed.

    I removed the assets directory from the project repository and modified the installation documentation accordingly.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    $e->getMessage() seems to return a string literal, so I'm not sure to understand what the problem was exactly.

    What returns is the value of the protected property $message. Since $e->getMessage() can return many different messages, what returns cannot be used as first argument of warning().
    The only way to call the logger methods like warning() is with code similar to the following (used by Drupal core).

    $this->logger->notice('Comment type %label has been updated.', ['%label' => $comment_type->label(), 'link' => $edit_link]);

    $this->logger->warning('Attempting to re-run cron while it is already running.');

    $this->logger('content')->info('book: updated %title.', ['%title' => $node->label(), 'link' => $node->toLink($this->t('View'))->toString()]);

    Every other value passed to those logger methods, including the concatenation of two literal strings, is not a literal string.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Ok, I didn't know that, thank you for the explanation @apaderno.

  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น

    Thank you for your contribution!
    I updated your account so you can now opt into security advisory coverage for any project you created and every project you will create.

    These are some recommended readings to help you with maintainership:

    You can find more contributors chatting on Slack โ†’ or IRC โ†’ in #drupal-contribute. So, come hang out and stay involved โ†’ !

    Thank you for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review โ†’ . I encourage you to learn more about that process and join the group of reviewers.

    I thank also the dedicated reviewers as well.

  • Assigned to apaderno
  • Status changed to Fixed 14 days ago
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly apaderno Brescia, ๐Ÿ‡ฎ๐Ÿ‡น
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance mably

    Thank you @apaderno.

Production build 0.69.0 2024