Return the url of the smallest photo above the dimensions.

    If no such photo exists, return None.
432662
def smallest_url(flickr, pid, min_width, min_height):
    
    sizes = flickr.photos_getSizes(photo_id=pid, format='parsed-json')
    smallest_url = None
    smallest_area = None
    for size in sizes['sizes']['size']:
        width = int(size['width'])
        height = int(size['height'])
        # Enforce a minimum height and width
        if width >= min_width and height >= min_height:
            if not smallest_url or height * width < smallest_area:
                smallest_area = height * width
                smallest_url = size['source']
    return smallest_url
104585
def image(version = nil)
      image = provide_attr(:image)

      return image.file.url(version) if image.respond_to?(:file)
      return image if image.present?

      fallback_image
    end
642337
def getImage(self):
        """"""
        value = self.__getNone(self.__dataItem['image']['url'])
        if value == None:
            return None
        else:
            return Sitools2Abstract.getBaseUrl(self) + self.__dataItem['image']['url']
21776
def _image_of_size(image_size):
  """"""
  return np.random.uniform(0, 256, [image_size, image_size, 3]).astype(np.uint8)
873941
def get_local_image(self, src):
        
        local_image = ImageUtils.store_image(None,
                                    self.link_hash, src, self.config)
        return local_image
206393
def get_photo_url(photo_id):
    
    args = _get_request_args(
        'flickr.photos.getSizes',
        photo_id=photo_id
    )
    resp = requests.post(API_URL, data=args)
    resp_json = json.loads(resp.text.encode('utf-8'))
    logger.debug(json.dumps(resp_json, indent=2))
    size_list = resp_json['sizes']['size']
    size_list_len = len(size_list)
    global image_size_mode
    image_size_mode = size_list_len if size_list_len < image_size_mode \
        else image_size_mode
    download_url = resp_json['sizes']['size'][-image_size_mode]['source']
    return download_url
451426
def get_blank_img(self):
        
        if photos_settings.DEBUG:
            return self.get_placeholder_img()

        out = {
            'blank': True,
            'width': self.max_width,
            'height': self.max_height,
            'url': photos_settings.EMPTY_IMAGE_SITE_PREFIX + 'img/empty/%s.png' % (self.name),
        }
        return out
1278740
def _get_thumbnail_url(image):
    
    lhs, rhs = splitext(image.url)
    lhs += THUMB_EXT
    thumb_url = f'{lhs}{rhs}'
    return thumb_url
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);
  }
572984
def size_from_name(size, sizes):

    """"""

    by_name = [s for s in sizes if s.name == size]
    if len(by_name) > 1:
        raise Exception('more than one image named %s exists' % size)
    return by_name[0]
759026
def get_image(width, height=None, background_color="cccccc", random_background_color=False):
    
    return Image(
        url=placeholdit.get_url(
            width,
            height=height,
            background_color=background_color,
            random_background_color=random_background_color
        ),
        credit="This is not an image credit",
        caption="This is not a caption"
    )
455965
def _get_scaled_image(self, resource):
        
        image = self._get_image()
        original_width, original_height = resource.size

        k = image.size[0] / float(image.size[1])

        if image.size[0] >= image.size[1]:
            target_width = int(original_width * self.size)
            target_height = int(target_width / k)
        else:
            target_height = int(original_height * self.size)
            target_width = int(target_height * k)

        image = image.resize((target_width, target_height), Image.ANTIALIAS)

        return image
66839
def _getImageSize(filename):
    """"""
    result = None
    file = open(filename, 'rb')
    if file.read(8) == b'\x89PNG\r\n\x1a\n': # PNG
        while 1:
            length, = _struct.unpack('>i', file.read(4))
            chunkID = file.read(4)
            if chunkID == '': # EOF
                break
            if chunkID == b'IHDR':
                # return width, height
                result = _struct.unpack('>ii', file.read(8))
                break
            file.seek(4 + length, 1)
        file.close()
        return result
    file.seek(0)
    if file.read(8) == b'BM': # Bitmap
        file.seek(18, 0) # skip to size data
        result = _struct.unpack('<ii', file.read(8))
    file.close()
    return result
766717
def distance_to_nearest_place(feature, parent):
    
    _ = feature, parent  # NOQA

    layer = exposure_summary_layer()
    if not layer:
        return None

    index = layer.fields().lookupField(
        distance_field['field_name'])
    if index < 0:
        return None

    feature = next(layer.getFeatures())
    return feature[index]
344952
def user_photo_url(user, size):
    """"""
    endpoint, kwargs = user_url_args(user, size)
    return url_for(endpoint, **kwargs)
1298777
function(res) {
      // handle thumbnail
      var picurl = '';
      // TODO: further process to thumbnail according to its size
      if (!res.thumbnail) {
        // if no thumbnail exists, a default pic should be returned.
        picurl = this.conf.CONST.PIC_PLACEHOLDER;
      } else {
        picurl = res.thumbnail.source;
      }
      res.extract = _.trunc(res.extract, {
        'length': this.conf.CONST.EXTRACT_REPLY_LIMIT, 
        'separator': /(，|。|\n)/
      });
      return {
        title: res.title,
        description: res.extract,
        url: this._page_url(res.title),
        picurl: picurl
      };
    }
353084
private static int getThumbnailKind(ResizeOptions resizeOptions) {
    if (ThumbnailSizeChecker.isImageBigEnough(
        MICRO_THUMBNAIL_DIMENSIONS.width(),
        MICRO_THUMBNAIL_DIMENSIONS.height(),
        resizeOptions)) {
      return MediaStore.Images.Thumbnails.MICRO_KIND;
    } else if (ThumbnailSizeChecker.isImageBigEnough(
        MINI_THUMBNAIL_DIMENSIONS.width(),
        MINI_THUMBNAIL_DIMENSIONS.height(),
        resizeOptions)) {
      return MediaStore.Images.Thumbnails.MINI_KIND;
    } else {
      return NO_THUMBNAIL;
    }
  }