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

Add support for SVG images to the image system within Moodle 2

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.4
    • 2.0
    • Themes
    • None
    • MOODLE_20_STABLE
    • MOODLE_24_STABLE
    • wip-MDL-22955-m24
    • Hide

      1. Run the unit tests, particularly lib/tests/outputlib_test.php

      2. Copy the following code into a test script in the root of your Moodle directory:

      <?php
      require_once('config.php');
      $PAGE->set_context(context_system::instance());
      $PAGE->set_url('/');
      echo $OUTPUT->pix_icon('i/test', 'You should never see this');

      3. Test this code in all of the supported browsers. In IE8 (or any earlier version) you should get a blue ball. In all other browsers you should get an orange ball.

      4. Test the order of image caching

      • Using IE8:
      • Turn off theme designer mode.
      • Purge the site caches
      • Visit the test script and make sure you see a blue ball.
      • Switch to Firefox or Chrome
      • Visit the test script and check you see an orange ball.
      • Switch back to IE8
      • Enable theme designer mode
      • Visit the test script and make sure you see a blue ball.
      • Switch to Firefox or Chrome
      • Visit the test script and check you see an orange ball.

      5. Test CSS

      • Edit theme/base/styles/admin.css
      • Add the following to the bottom: #sams-svg-test {background-image:url([[pix:core|i/test]]);}
      • Using Firefox or Chrome
      • Purge your caches
      • Using the dev toolkit (firebug or dev tools) find the admin CSS file contents. If you have theme designer mode on it will be a separate sheet, otherwise it will be a sheet called all.
      • Search the CSS for #sams-svg-test
      • Check that the URL either contains /_s/ if theme designer mode off or svg=0 if theme designer mode is on.
      Show
      1. Run the unit tests, particularly lib/tests/outputlib_test.php 2. Copy the following code into a test script in the root of your Moodle directory: <?php require_once('config.php'); $PAGE->set_context(context_system::instance()); $PAGE->set_url('/'); echo $OUTPUT->pix_icon('i/test', 'You should never see this'); 3. Test this code in all of the supported browsers. In IE8 (or any earlier version) you should get a blue ball. In all other browsers you should get an orange ball. 4. Test the order of image caching Using IE8: Turn off theme designer mode. Purge the site caches Visit the test script and make sure you see a blue ball. Switch to Firefox or Chrome Visit the test script and check you see an orange ball. Switch back to IE8 Enable theme designer mode Visit the test script and make sure you see a blue ball. Switch to Firefox or Chrome Visit the test script and check you see an orange ball. 5. Test CSS Edit theme/base/styles/admin.css Add the following to the bottom: #sams-svg-test {background-image:url([[pix:core|i/test]]);} Using Firefox or Chrome Purge your caches Using the dev toolkit (firebug or dev tools) find the admin CSS file contents. If you have theme designer mode on it will be a separate sheet, otherwise it will be a sheet called all. Search the CSS for #sams-svg-test Check that the URL either contains /_s/ if theme designer mode off or svg=0 if theme designer mode is on.

      Hi guys,

      The order of file extension Moodle searches when locating an image was discussed in the forum not so long ago and the question was raised about why SVG was not on the list.
      I've created this issue because I think it would be a great idea to add support for using SVG images, particularly so themer's can override core images with SVG's.

      I purpose to prepend SVG to the list of image formats that Moodle searches for unless the user is using IE < 9 (they've finally added SVG support in IE 9). This would of course make SVG the first format searched for which is probably fine given that it won't be used if the users browser doesn't support it.

      Before I produce a patch or anything I would like to get some feedback from people about this.

      Cheers
      sam

            samhemelryk Sam Hemelryk
            samhemelryk Sam Hemelryk
            Dan Poltawski Dan Poltawski
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Ankit Agarwal Ankit Agarwal
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.