Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32471

Add support for previews of stored files

    Details

    • Testing Instructions:
      Hide

      Testing difficulty: easy

      1. Embed an image into a HTML editor and save the form (eg. HTML block, module introduction etc).
      2. When the page displays the embedded image, copy the image's URL (something like http://site/pluginfile.php?file=/42/something/something/etc
      3. Paste the URL into your browser's address bar
      4. Modify the URL and append &preview=tinyicon or &preview=thumb to its end
      5. TEST: Make sure a smaller version of the image is displayed

      This is to test the basic functionality. It is not used anywhere in the code yet (to be done once integrated).

      Show
      Testing difficulty: easy 1. Embed an image into a HTML editor and save the form (eg. HTML block, module introduction etc). 2. When the page displays the embedded image, copy the image's URL (something like http://site/pluginfile.php?file=/42/something/something/etc 3. Paste the URL into your browser's address bar 4. Modify the URL and append &preview=tinyicon or &preview=thumb to its end 5. TEST: Make sure a smaller version of the image is displayed This is to test the basic functionality. It is not used anywhere in the code yet (to be done once integrated).
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-32471-thumbnails

      Description

      Filepicker needs to display image previews (thumbnail) of internal images.
      The work consists of following parts:

      1) We need to implement resizing of images to thumbnail size and storing them. There should be URL that returns thumbnail instead of a file. So far it seems that the best way to do it is to add parameter to pluginfile.php, something like
      http://WWWMOODLE/pluginfile.php/296/mod_folder/intro/Cloud%2C.jpg?size=thumb
      When the thumbnail is requested we check if it exists and was modified after the file was modified and return it. Otherwise generate and store new thumbnail.

      AFAIK Dongsheng was working on such temporary storages.

      There should be cron that cleans old thumbnails.

      Another question is how many thumbnail sizes do we want to store. For Filepicker we really need two: bigger thumbnail in "icon view mode" (90x90 seems to be a good size here) and smaller icon for "table/list view mode" (16x16). Probably we don't need to store 16x16, we'll just ask browser to scale bigger thumbnail image. MD was suggesting to store something in between (i.e. 75x75), scale it up for thumbnail and scale down for icon.

      2) local repositories (local, recent, user, filesystem, coursefiles) shall return for each file not only URL of filetype image ('thumbnail') but also URL of generated thumbnail (i.e. 'realthumbnail')

      3) repository/filepicker.js must implement lazy loading of the real thumbnails. When page is displayed the 'thumbnail's are shown and filepicker starts requesting in background the images of 'realthumbnail's and replace them.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    25/Jun/12