Example #1
0
 def _thumbnail_url(self, fileobj, thumbnail_size):
     """Create the thumbnail URL for an image."""
     return link_for(
         current_app.config.get('THEME_SITEURL'),
         'thumbnail',
         path=ui_iiif_image_url(
             fileobj,
             size='{},'.format(thumbnail_size),
             image_format='png' if fileobj['type'] == 'png' else 'jpg',
         ))
Example #2
0
 def _thumbnail_url(self, fileobj , thumbnail_size):
     """Create the thumbnail URL for an image."""
     return link_for(
         current_app.config.get('THEME_SITEURL'),
         'thumbnail',
         path=ui_iiif_image_url(
             fileobj,
             size='{},'.format(thumbnail_size),
             image_format='png' if fileobj['type'] == 'png' else 'jpg',
         )
     )
Example #3
0
 def get_thumbnail_url(self, obj):
     """Dump thumbnailUrl."""
     files = obj.get('metadata', {}).get('_files', [])
     for f in files:
         if f.get('type') in thumbnail_exts:
             return ui_link_for(
                 'thumbnail',
                 path=ui_iiif_image_url(
                     f,
                     size='{},'.format(250),
                     image_format='png' if f['type'] == 'png' else 'jpg',
                 ))
     return missing
Example #4
0
def test_ui_iiif_image_url(appctx, image_object):
    """Test retrieval of image info."""
    assert iiif_image_url(uuid=iiif_image_key(image_object)).endswith(
        ui_iiif_image_url(image_object)
    )
Example #5
0
def test_ui_iiif_image_url(appctx, image_object):
    """Test retrieval of image info."""
    assert iiif_image_url(uuid=iiif_image_key(image_object)).endswith(
        ui_iiif_image_url(image_object)
    )
Example #6
0
def test_preview(image_object):
    """Test preview."""
    assert ui_iiif_image_url(image_object, size='750,', image_format='jpg') \
        in preview(MockPreviewFile(image_object, 'jpg'))
Example #7
0
def test_preview(image_object):
    """Test preview."""
    assert ui_iiif_image_url(image_object, size='750,', image_format='jpg') \
        in preview(MockPreviewFile(image_object, 'jpg'))
Example #8
0
 def resize_link(frame, size):
     return '{}{}'.format(
         current_app.config.get('THEME_SITEURL'),
         ui_iiif_image_url(frame,
                           size='!{0[0]},{0[1]}'.format(size),
                           image_format='png'))