Moodle

replace image and icon handling

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0
  • Fix Version/s: 2.0
  • Component/s: Themes
  • Labels:
    None
  • Affected Branches:
    MOODLE_20_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

See proposal linked in parent bug. This will involve removal of smartpix and reshufling of images.

New $PAGE->image_url($imagename, $component='moodle') which returns URL instance which fully replaces old_icon_url() and mod_icon_url().

I think we should also add __toString() to the moodle_url class which would make the conversion much easier.
We might also add moodle_url::out_raw() which just returns unescaped URLs that are needed in JS code - the three parameters are horrible when all you need is just unescaped "raw" url imho

Activity

Hide
Tim Hunt added a comment -

I agree with all this. I assume you will keep the delegation from $PAGE to theme_config, so the details stay encapsulated.

Show
Tim Hunt added a comment - I agree with all this. I assume you will keep the delegation from $PAGE to theme_config, so the details stay encapsulated.
Hide
Sam Marshall added a comment -

When this is implemented, could we ensure that it supports GIF->PNG changes in theme? E.g we have some theme changes I'm doing right now locally, which will require a PNG icon be used in place of module 'icon.gif',. I'm modifying smartpix (maybe just locally, not sure yet) to make that work (ie you make file icon.png, this will be served - with png mimetype - in response to smartpix request for icon.gif) but it would be good in 2.0 also. Unless we're going to just change all the icons to PNG which would be fine too but...

Show
Sam Marshall added a comment - When this is implemented, could we ensure that it supports GIF->PNG changes in theme? E.g we have some theme changes I'm doing right now locally, which will require a PNG icon be used in place of module 'icon.gif',. I'm modifying smartpix (maybe just locally, not sure yet) to make that work (ie you make file icon.png, this will be served - with png mimetype - in response to smartpix request for icon.gif) but it would be good in 2.0 also. Unless we're going to just change all the icons to PNG which would be fine too but...
Hide
Petr Škoda (skodak) added a comment -

yes, arbitrary icon types are to be supported

Show
Petr Škoda (skodak) added a comment - yes, arbitrary icon types are to be supported
Hide
Petr Škoda (skodak) added a comment -

done, now the right way to get any image is $OUTPUT->pix_url($name, $component) :-D

Show
Petr Škoda (skodak) added a comment - done, now the right way to get any image is $OUTPUT->pix_url($name, $component) :-D

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: