Opened 14 years ago

Last modified 13 years ago

#111 closed defect (FIXED)

Resize images to fit on page

Reported by: Christopher Allan Webber Owned by: Christopher Allan Webber
Priority: major Milestone: 0.0.4
Component: programming Keywords:
Cc: Parent Tickets:

Description

We've finally agreed on a maximum width and height for images on
their main page, which is max width 640, max height 640. As such,
uploading code should be adjusted to add such an image when the
image is larger than either of those parameters



Change History (11)

comment:1 by joar, 14 years ago

Milestone: 0.0.3
Owner: set to Joar Wandborg

comment:1 by joar, 13 years ago

Changes published to
[https://gitorious.org/\ :sub:`jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/feature\_400-resize\_images\_to\_fit\_page](https://gitorious.org/`\ jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/feature\_400-resize\_images\_to\_fit\_page)



comment:2 by Christopher Allan Webber, 13 years ago

Merged your branch, thanks!

Before we close this I'd like to make use of this generic method
though, or something like it:

::

    IMAGE_FETCHING_ORDER = [u'medium', u'full', u'thumb']
    
    def get_display_media(media_map, fetch_order=IMAGE_FETCHING_ORDER):
        """ 
        Find the best media for display.
    
        Args:
         - media_map: a dict like {u'image_size': [u'dir1', u'dir2', u'image.jpg']}
         - fetch_order: the order we should try fetching images in
    
        Returns:
         (media_size, media_path)
        """ 
        media_sizes = media_map.keys()
        for media_size in IMAGE_FETCHING_ORDER:
            if media_size in media_sizes:
                return (media_size, media_map[media_size])



comment:3 by joar, 13 years ago

My branch is updated with the changes, and additionally, renaming
of ``main`` => ``original``. I won't write any migration for
``media_entries`` until the migration issue is solved ;)

[https://gitorious.org/\ :sub:`jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/feature\_400-resize\_images\_to\_fit\_page](https://gitorious.org/`\ jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/feature\_400-resize\_images\_to\_fit\_page)



comment:4 by joar, 13 years ago

Milestone: 0.0.30.0.4

comment:4 by Christopher Allan Webber, 13 years ago

Merged your latest changes. I should get the migration stuff done
this weekend, then we should be able to close out the rest.
Thanks!



comment:5 by Christopher Allan Webber, 13 years ago

Actually, I thought I merged, but didn't miss the merge conflict.

I got a bit confused while trying to merge this stuff so I'll do it
later (or maybe joar can figure out the merging for me. ;))



comment:6 by joar, 13 years ago

Owner: changed from Joar Wandborg to Christopher Webber
Status: NewFeedback
Merged with 9980c5f4f4c0b91d854e730cef299ee1a3da86da in my
``master``:
[https://gitorious.org/\ :sub:`jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/master](https://gitorious.org/`\ jwandborg/mediagoblin/jwandborgs-mediagoblin/commits/master)



comment:7 by Christopher Allan Webber, 13 years ago

BTW, new migrations merged, so this can make use of them now...



comment:8 by Christopher Allan Webber, 13 years ago

Status: FeedbackClosed
Oh, this is merged and done :)



comment:9 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/400 .
Relations:
#121: blocked

Note: See TracTickets for help on using tickets.