← Back to team overview

mahara-contributors team mailing list archive

[Bug 1416890] Re: Use SVG images and provide backward compatibility

 

We don't have any immediate plans to do this, but if a person were to
implement this, the place to start would be looking at the Theme class
in lib/web.php. Currently images are served up with the
$THEME->get_url() method, which abstracts out the specific theme to
allow for theme inheritance. We'd need to add a second method alongside
that abstracts out the file suffix for image files.

See
https://wiki.mahara.org/index.php/Customising/Themes/1.10#Core_assets
for details on how it currently works.

Cacheing it is a separate issue. Our theme system currently doesn't do
any cacheing at all. Every time it's looking for a particular file, it
hits the filesystem to find it. I haven't run any tests to see whether
this causes us any slowdown, though. I suppose an easy way to test it
would be to modify $THEME->get_url() so that it's hardcoded to use the
"raw" theme instead of checking for the existence of files.

And the third issue is browser detection. We currently have a library
that detects whether you're using a phone or table, but we don't do any
browser sniffing beyond that. In fact, in the Mahara README we limit
Mahara support to the latest versions of Firefox & Chrome, and the last
three releases of IE (currently IE9, 10, and 11). All of those support
SVG files: http://caniuse.com/#feat=svg

So, we wouldn't be adding any code to Mahara core to check for browser
support for SVGs. But if we did implement the file-format-abstracting
system described above, we could add a local/lib.php hook in lib/web.php
to allow sites have to support IE8 to customize the process of deciding
which file format to use.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1416890

Title:
  Use SVG images and provide backward compatibility

Status in Mahara ePortfolio:
  Triaged

Bug description:
  Suggestion by Gilles-Philippe Leblanc:

  In the Moodle software, the images are all managed by a cascade system.
  The function initially looking if a svg file exists, then a png, then gif, jpg and ico.

  This lets you use a svg file and maintain backward compatibility.

  The system also detects if the browser supports SVG. Generally, all
  browsers support this format except Internet Explorer 8 and below.

  Everything is cached to avoid unnecessary calculation.

  So I was wondering if it was planned to add the following components to do this:
  * A library for browser detection on the server side
  * A function to find the right file extension
  * A library for caching php

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1416890/+subscriptions


References