Changeset f0e64eb in OpenWorkouts-current for ow/templates


Ignore:
Timestamp:
Feb 15, 2019, 11:00:35 AM (5 years ago)
Author:
Borja Lopez <borja@…>
Branches:
current, feature/docs, master
Children:
0fa21cd
Parents:
eb20dc8
Message:

(#51) Fixed profile images were too big:

  • Added new dependency (Pillow)
  • Modified the user profile picture view. Now it accepts a GET parameter (size) telling the size of the image we want. Only one value is needed, the code will scale the image appropiately.
  • Modified the dashboard, profile and edit_profile templates to ask for a smaller version (200px) of the user profile picture.

IMPORTANT: Ensure you install Pillow in any existing environments after pulling:

pip install Pillow

Location:
ow/templates
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ow/templates/dashboard.pt

    reb20dc8 rf0e64eb  
    101101          <tal:c tal:condition="getattr(context, 'picture', None)">
    102102            <a href="" tal:attributes="href request.resource_url(context, 'profile')">
    103               <img tal:attributes="src request.resource_path(context, 'picture')"
     103              <img tal:attributes="src request.resource_path(context, 'picture', query={'size': 200})"
    104104                   width="450" />
    105105            </a>
  • ow/templates/edit_profile.pt

    reb20dc8 rf0e64eb  
    4949                      <label for="current_picture" i18n:translate="">
    5050                          Current picture:</label>
    51                       <img id="current_picture" tal:attributes="src request.resource_path(context, 'picture')" width="150">
     51                      <img id="current_picture"
     52                           tal:attributes="src request.resource_path(context, 'picture', query={'size': 200})"
     53                           width="150">
    5254                  </tal:c>
    5355                </div>
  • ow/templates/profile.pt

    reb20dc8 rf0e64eb  
    1818        <div>
    1919          <tal:c tal:condition="getattr(user, 'picture', None)">
    20             <img tal:attributes="src request.resource_path(user, 'picture')"
     20            <img tal:attributes="src request.resource_path(user, 'picture', query={'size': 200})"
    2121                 width="450" />
    2222          </tal:c>
Note: See TracChangeset for help on using the changeset viewer.