Get the image URL - uses the thumbnail if set, then the main image, otherwise returns null.
502125
public String getImageUrl() {
    if (thumbnailUrl != null) {
      return thumbnailUrl;
    }

    if (image != null) {
      return image.url;
    }

    return null;
  }
585414
def get_image_set(self):
        
        image_set_pk = self.kwargs.get("pk", None)
        if image_set_pk is None:
            return self.request.user.image_sets.create()
        return get_object_or_404(self.get_queryset(), pk=image_set_pk)
652817
protected function getImageUrl()
    {
        $imageUrl = "";

        if ($this->getImagePath()) {
            $imageUrl = $this->getImageDirUrl() . $this->getImageName();
        }

        return $imageUrl;
    }
726185
def _get_image_url(self, image_id):
        
        gce = self._connect()
        filter = "name eq %s" % image_id
        request = gce.images().list(project=self._project_id, filter=filter)
        response = self._execute_request(request)
        response = self._wait_until_done(response)

        image_url = None
        if "items" in response:
            image_url = response["items"][0]["selfLink"]

        if image_url:
            return image_url
        else:
            raise ImageError("Could not find given image id `%s`" % image_id)
1278740
def _get_thumbnail_url(image):
    
    lhs, rhs = splitext(image.url)
    lhs += THUMB_EXT
    thumb_url = f'{lhs}{rhs}'
    return thumb_url
1364068
def _get_image_or_404(identifier, load_image=False):
    
    try:
        image_id = int(identifier)
    except ValueError:
        raise Http404()

    ik_image = get_object_or_404(ICEkitImage, id=image_id)
    if not load_image:
        return ik_image, None

    ####################################################################
    # Image-loading incantation cribbed from easythumbnail's `pil_image`
    image = Image.open(BytesIO(ik_image.image.read()))
    # Fully load the image now to catch any problems with the image contents.
    try:
        # An "Image file truncated" exception can occur for some images that
        # are still mostly valid -- we'll swallow the exception.
        image.load()
    except IOError:
        pass
    # Try a second time to catch any other potential exceptions.
    image.load()
    if True:  # Support EXIF orientation data
        image = et_utils.exif_orientation(image)
    ####################################################################

    return ik_image, image
890419
def getImage(self):
        '''
        

        '''
        self.lock.acquire()
        image = self.data
        self.lock.release()
        
        return image
1123149
def thumbnail_url(options = {})
      return if picture.nil?

      crop = crop_values_present? || content.settings_value(:crop, options)
      size = render_size || content.settings_value(:size, options)

      options = {
        size: thumbnail_size(size, crop),
        crop: !!crop,
        crop_from: crop_from.presence,
        crop_size: crop_size.presence,
        flatten: true,
        format: picture.image_file_format
      }

      picture.url(options)
    end
1196385
public static Bitmap getThumbnail(Context context, Uri uri, String mimeType) {
        if (DEBUG)
            Log.d(TAG, "Attempting to get thumbnail");

        if (!isMediaUri(uri)) {
            Log.e(TAG, "You can only retrieve thumbnails for images and videos.");
            return null;
        }

        Bitmap bm = null;
        if (uri != null) {
            final ContentResolver resolver = context.getContentResolver();
            Cursor cursor = null;
            try {
                cursor = resolver.query(uri, null, null, null, null);
                if (cursor.moveToFirst()) {
                    final int id = cursor.getInt(0);
                    if (DEBUG)
                        Log.d(TAG, "Got thumb ID: " + id);

                    if (mimeType.contains("video")) {
                        bm = MediaStore.Video.Thumbnails.getThumbnail(
                                resolver,
                                id,
                                MediaStore.Video.Thumbnails.MINI_KIND,
                                null);
                    }
                    else if (mimeType.contains(FileUtils.MIME_TYPE_IMAGE)) {
                        bm = MediaStore.Images.Thumbnails.getThumbnail(
                                resolver,
                                id,
                                MediaStore.Images.Thumbnails.MINI_KIND,
                                null);
                    }
                }
            } catch (Exception e) {
                if (DEBUG)
                    Log.e(TAG, "getThumbnail", e);
            } finally {
                if (cursor != null)
                    cursor.close();
            }
        }
        return bm;
    }
950900
public function thumbnailUrl() : string
    {
        return ($this->info()->threadThumbnailDetail->status == 2) ? 
        "" : 
        $this->info()->threadThumbnailDetail->resourcePath;
    }
924219
function() {
        return new ImageUrl({
            transformations: this.transformations.slice(0),
            baseUrl: this.rootUrl,
            user: this.user,
            publicKey: this.publicKey,
            privateKey: this.privateKey,
            imageIdentifier: this.imageIdentifier,
            extension: this.extension,
            queryString: this.queryString,
            path: this.path
        });
    }
1361687
def thumbUrl(self):
        
        thumb = self.firstAttr('thumb', 'parentThumb', 'granparentThumb')
        return self._server.url(thumb, includeToken=True) if thumb else None
558107
def get_thumbnail(self, file_, geometry_string, **options):
        
        logger.debug('Getting thumbnail for file [%s] at [%s]', file_, geometry_string)

        if file_:
            source = ImageFile(file_)
        else:
            raise ValueError('falsey file_ argument in get_thumbnail()')

        # preserve image filetype
        if settings.THUMBNAIL_PRESERVE_FORMAT:
            options.setdefault('format', self._get_format(source))

        for key, value in self.default_options.items():
            options.setdefault(key, value)

        # For the future I think it is better to add options only if they
        # differ from the default settings as below. This will ensure the same
        # filenames being generated for new options at default.
        for key, attr in self.extra_options:
            value = getattr(settings, attr)
            if value != getattr(default_settings, attr):
                options.setdefault(key, value)

        name = self._get_thumbnail_filename(source, geometry_string, options)
        thumbnail = ImageFile(name, default.storage)
        cached = default.kvstore.get(thumbnail)

        if cached:
            return cached

        # We have to check exists() because the Storage backend does not
        # overwrite in some implementations.
        if settings.THUMBNAIL_FORCE_OVERWRITE or not thumbnail.exists():
            try:
                source_image = default.engine.get_image(source)
            except IOError as e:
                logger.exception(e)
                if settings.THUMBNAIL_DUMMY:
                    return DummyImageFile(geometry_string)
                else:
                    # if S3Storage says file doesn't exist remotely, don't try to
                    # create it and exit early.
                    # Will return working empty image type; 404'd image
                    logger.warning(
                        'Remote file [%s] at [%s] does not exist',
                        file_, geometry_string,
                    )
                    return thumbnail

            # We might as well set the size since we have the image in memory
            image_info = default.engine.get_image_info(source_image)
            options['image_info'] = image_info
            size = default.engine.get_image_size(source_image)
            source.set_size(size)

            try:
                self._create_thumbnail(source_image, geometry_string, options,
                                       thumbnail)
                self._create_alternative_resolutions(source_image, geometry_string,
                                                     options, thumbnail.name)
            finally:
                default.engine.cleanup(source_image)

        # If the thumbnail exists we don't create it, the other option is
        # to delete and write but this could lead to race conditions so I
        # will just leave that out for now.
        default.kvstore.get_or_set(source)
        default.kvstore.set(thumbnail, source)
        return thumbnail
760992
public static Image getClipboardImage() {
        Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        try {
            return (Image) clipboard.getData(DataFlavor.imageFlavor);
        } catch (Exception e) {
            return null;
        }
    }
1052028
def image(self):
        ''''''
        r = requests.get(self.image_url, stream=True)
        r.raise_for_status()
        return r.raw.read()
94753
def get_image(cls, url):
        
        from PIL.ImageFile import Parser as PILParser

        length = 0
        raw_image = None
        with closing(request.get(url, stream=True)) as response:
            response.raise_for_status()
            response_url = response.url
            parser = PILParser()
            for chunk in response.iter_content(config.CHUNK_SIZE):
                length += len(chunk)
                if length > config.IMAGE_MAX_BYTESIZE:
                    del parser
                    raise cls.MaxBytesException
                parser.feed(chunk)
                # comment this to get the whole file
                if parser.image and parser.image.size:
                    raw_image = parser.image
                    del parser # free some memory
                    break
            # or this to get just the size and format
            # raw_image = parser.close()
        if length == 0:
            raise cls.ZeroBytesException
        if not raw_image:
            raise cls.NoImageException
        image = Image(response_url, raw_image.size, raw_image.format)
        return image
923436
def get_thumbnail_image_url(self, page=1):
        
        template = self.resources.page.get('image')
        return template.replace(
            "{page}",
            str(page)
        ).replace("{size}", "thumbnail")