A filter to return the URL for the provided resolution of the thumbnail.
761605
def resolution(file_, resolution_string):
    
    if sorl_settings.THUMBNAIL_DUMMY:
        dummy_source = sorl_settings.THUMBNAIL_DUMMY_SOURCE
        source = dummy_source.replace('%(width)s', '(?P<width>[0-9]+)')
        source = source.replace('%(height)s', '(?P<height>[0-9]+)')
        source = re.compile(source)
        try:
            resolution = decimal.Decimal(resolution_string.strip('x'))
            info = source.match(file_).groupdict()
            info = {dimension: int(int(size) * resolution) for (dimension, size) in info.items()}
            return dummy_source % info
        except (AttributeError, TypeError, KeyError):
            # If we can't manipulate the dummy we shouldn't change it at all
            return file_

    filename, extension = os.path.splitext(file_)
    return '%s@%s%s' % (filename, resolution_string, extension)
676373
def _thumbnail_resize(self, image, thumb_size, crop=None, bg=None):
        """"""

        if crop == 'fit':
            img = ImageOps.fit(image, thumb_size, Image.ANTIALIAS)
        else:
            img = image.copy()
            img.thumbnail(thumb_size, Image.ANTIALIAS)

        if bg:
            img = self._bg_square(img, bg)

        return img
649061
def getImageObject(url, referrer, session, max_content_bytes=MaxImageBytes):
    """"""
    return urlopen(url, session, referrer=referrer, max_content_bytes=max_content_bytes, stream=True)
1212977
def make_thumbnail_name(image_name, extension):
    """"""
    file_name, _ = os.path.splitext(image_name)
    return file_name + '.' + clean_extension(extension)
662698
def get_uri(self, image):
        '''
        '''
        image = image or ''
        uri = ''

        match = re.match("^(?P<uri>.+)://", image)
        if match:
            uri = match.group('uri')

        return uri
564504
def thumb(self, obj):
        
        format, created = Format.objects.get_or_create(name='newman_thumb',
                                                       defaults={
            'max_width': 100,
            'max_height': 100,
            'flexible_height': False,
            'stretch': False,
            'nocrop': True,
        })

        if created:
            format.sites = Site.objects.all()

        info = obj.get_formated_photo(format)

        return '<a href="%(href)s"><img src="%(src)s"></a>' % {
            'href': '%s/' % obj.pk,
            'src': info['url']
        }
91312
public function get_thumb_url($image_url, $orig_width, $orig_height, $thumb_width = 75, $force = false) {
        global $OUTPUT;

        if (!$force && $orig_width <= $thumb_width && $orig_height <= $thumb_width) {
            return $image_url;
        } else {
            $thumb_url = '';
            $commons_main_dir = 'https://upload.wikimedia.org/wikipedia/commons/';
            if ($image_url) {
                $short_path = str_replace($commons_main_dir, '', $image_url);
                $extension = strtolower(pathinfo($short_path, PATHINFO_EXTENSION));
                if (strcmp($extension, 'gif') == 0) {  //no thumb for gifs
                    return $OUTPUT->image_url(file_extension_icon('.gif', $thumb_width))->out(false);
                }
                $dir_parts = explode('/', $short_path);
                $file_name = end($dir_parts);
                if ($orig_height > $orig_width) {
                    $thumb_width = round($thumb_width * $orig_width/$orig_height);
                }
                $thumb_url = $commons_main_dir . 'thumb/' . implode('/', $dir_parts) . '/'. $thumb_width .'px-' . $file_name;
                if (strcmp($extension, 'svg') == 0) {  //png thumb for svg-s
                    $thumb_url .= '.png';
                }
            }
            return $thumb_url;
        }
    }
90213
def get_url(width, height, color=True):
    
    d = dict(width=width, height=height)
    return URL % d
923436
def get_thumbnail_image_url(self, page=1):
        
        template = self.resources.page.get('image')
        return template.replace(
            "{page}",
            str(page)
        ).replace("{size}", "thumbnail")
562809
private function resolveResourceThumbnail($defaultImage)
    {
        $baseFolder = $this->getBaseFolder();
        $iconUrl = $baseFolder.DIRECTORY_SEPARATOR.'default_thumbnail.png';
        foreach ($this->getThumbnailBaseFolderPaths() as $path) {
            $imageFilePath = $path.DIRECTORY_SEPARATOR.$defaultImage;

            if (file_exists($imageFilePath) && is_readable($imageFilePath)) {
                $iconUrl = $baseFolder.DIRECTORY_SEPARATOR.$defaultImage;
                break;
            }
        }

        return $iconUrl;
    }
854943
def thumbnail(self, size):
        ''''''
        if size in self.thumbnail_sizes:
            return self.thumbnails.get(str(size))
        else:
            raise ValueError('Unregistered thumbnail size {0}'.format(size))
1227741
def url(size: nil, use_ssl: false)
      size = case size
             when :small_square, :small, :s
               's'
             when :large_thumbnail, :large, :l
               'l'
             else
               ''
             end

      splitted_link = link(use_ssl).split('.')
      splitted_link[splitted_link.size - 2] << size
      splitted_link.join '.'
    end
1234289
private static Observable<Bitmap> getThumbnailFromUriWithSize(final Context context,
      final Uri data, final int requiredWidth, final int requiredHeight) {
    return getThumbnailFromUriWithSizeAndKind(context, data, requiredWidth, requiredHeight,
        MediaStore.Images.Thumbnails.MINI_KIND);
  }
120112
def get_thumbnail_image(self, page=1):
        
        url = self.get_thumbnail_image_url(page=page)
        return self._get_url(url)
97817
def sponsor_image_url(sponsor, name):
    """"""
    if sponsor.files.filter(name=name).exists():
        # We avoid worrying about multiple matches by always
        # returning the first one.
        return sponsor.files.filter(name=name).first().item.url
    return ''
392701
function (url) {
            if (this.$.width) {
                url += ",width=" + ImageService.normalizeImageSize(this.$.width);
            }

            if (this.$.height) {
                url += ",height=" + ImageService.normalizeImageSize(this.$.height);
            }

            return url;
        }
459660
def get_thumbnail(file_, name):
    
    options = settings.OPTIONS_DICT[name]
    opt = copy(options)
    geometry = opt.pop('geometry')

    return original_get_thumbnail(file_, geometry, **opt)