Problem/Motivation

The file extensions to be used to retrieve the list of files in the dropdown image selector is hardcoded.

  protected function getList() {
    $filelist = array();
    if (is_dir($this->configuration['path']) && $handle = opendir($this->configuration['path'])) {
      while ($file = readdir($handle)) {
        if (preg_match("/\.gif|\.png|\.jpg|\.jpeg$/i", $file) == 1) { // @todo make this list dependent on toolkit capabilities
          $filelist[] = $file;
        }
      }
      closedir($handle);
    }
    return $filelist;
  }

Proposed resolution

Test files' extension against ImageFactory::getSupportedExtensions.

Remaining tasks

Write patch

User interface changes

List of image files will include any image supported by the default toolkit.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#8 2651768-8.patch199.53 KBmondrake
#8 interdiff_6-8.txt820 bytesmondrake
#6 2651768-6.patch4.76 KBmondrake

Comments

mondrake created an issue. See original summary.

slashrsm’s picture

Issue tags: +Media Initiative, +D8Media, +Novice
joshi.rohit100’s picture

Assigned: Unassigned » joshi.rohit100
mondrake’s picture

Title: ImageSelector\Dropdown::getList should return all files supported by current toolkit » [PP-1] ImageSelector\Dropdown::getList should return all files supported by current toolkit
Status: Active » Postponed
Related issues: +#1014816: Allow image fields to use any extensions the current image toolkit supports (instead of hard-coding jpg, png and gif only)

Given current status of D8 HEAD, if we do this now we will miss .jpg and .jpe files when GD toolkit is in use. I suggest to postpone till when #1014816: Allow image fields to use any extensions the current image toolkit supports (instead of hard-coding jpg, png and gif only) lands.

mondrake’s picture

mondrake’s picture

Title: [PP-1] ImageSelector\Dropdown::getList should return all files supported by current toolkit » ImageSelector\Dropdown::getList should return all files supported by current toolkit
Assigned: joshi.rohit100 » Unassigned
Issue summary: View changes
Status: Postponed » Needs review
Issue tags: -Novice +Needs tests
StatusFileSize
new4.76 KB

#2477381: GDToolkit::getSupportedExtensions returns incomplete list has been committed to 8.2.x. We need to wait for the commit to 8.1.x and set the required Drupal core version to the first patch one.

Also, needs tests.

gábor hojtsy’s picture

Issue tags: -Media Initiative
mondrake’s picture

Issue tags: -Needs tests
StatusFileSize
new820 bytes
new199.53 KB

Changed test to ensure a .jpe image is listed; added an test .jpe image file

Status: Needs review » Needs work

The last submitted patch, 8: 2651768-8.patch, failed testing.

mondrake’s picture

Status: Needs work » Needs review

#8 is green.

mondrake’s picture

  • mondrake committed 983d09b on 8.x-1.x
    Issue #2651768 by mondrake: ImageSelector\Dropdown::getList should...
mondrake’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.