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

$OUTPUT->user_picture() doesn't precisely respect the supplied size parameter and does not point it out in phpdocs

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.9
    • None
    • Libraries
    • MOODLE_29_STABLE

    Description

      $OUTPUT->user_picture() has an optional size parameter that lets you set the size of the image you want.

      $output .= $OUTPUT->user_picture($postuser, array('courseid'=>$course->id));

      The above gets you the default, 35px square. The following requests a 60px image.

      $output .= $OUTPUT->user_picture($postuser, array('courseid'=>$course->id, 'size' => 60));

      However a 100px square is supplied. You get exactly the same image if you do this.

      $output .= $OUTPUT->user_picture($postuser, array('courseid'=>$course->id, 'size' => 100));

      Its not the end of the world as client side CSS can shrink a 100px image down to 60px but if we it would be nice if we could give the calling code what it asks for.

      If we aren't going to return precisely the size requests user_picture()'s php docs should at least make the situation clear. So either provide the exact right size of updated phpdocs to explain what is going on here.

      Line 3409 in mod_forum lib.php is an easy place to experiment with this. It produces the user profile pictures for forum posts.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              andyjdavis Andrew Davis
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: