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

mimeinfo() sould return SVG icon without postfix/dimension

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.1.14
    • Files API
    • None
    • MOODLE_401_STABLE

      Hi, I see that the mimeinfo function returns the SVG icon only if it has the associated postfix, ie pdf-24.svg pdf-48.svg etc.

      I think it would be better that if the xxx.svg icon is there it is returned instead, even if "xxx-24" is requested.
      This would save a lot of effort and space.

      Just in case I'll put here a suggested modification to implement this feature

      // lib/filelib.php
      // function mimeinfo()
      function mimeinfo($element, $filename) {
          ......
              // find the file with the closest size, first search for specific icon then for default icon
       
          foreach ($iconpostfixes as $size => $postfix) {
              $fullname = $CFG->dirroot.'/pix/f/'.$filename;
              if ($iconsize >= $size &&
                      (file_exists($fullname.'.svg') || file_exists($fullname.$postfix.'.png') || file_exists($fullname.$postfix.'.gif'))) {
                  return $filename.$postfix;
              }
          }
       .....
      }

            Unassigned Unassigned
            deligant Christian Deligant
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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