Return an iterator which returns ThumbnailFile instances.
489522
def get_thumbnails(self, *args, **kwargs):
        
        # First, delete any related thumbnails.
        source_cache = self.get_source_cache()
        if source_cache:
            thumbnail_storage_hash = utils.get_storage_hash(
                self.thumbnail_storage)
            for thumbnail_cache in source_cache.thumbnails.all():
                # Only iterate files which are stored using the current
                # thumbnail storage.
                if thumbnail_cache.storage_hash == thumbnail_storage_hash:
                    yield ThumbnailFile(name=thumbnail_cache.name,
                                        storage=self.thumbnail_storage)
1350358
def _get_thumbnail_filename(filename, append_text="-thumbnail"):
    
    name, ext = os.path.splitext(filename)
    return ''.join([name, append_text, ext])
1091582
def get_thumbnail_source(self, obj):
        
        if hasattr(self, 'thumbnail_field') and self.thumbnail_field:
            return resolve(obj, self.thumbnail_field)

        # try get_list_image, from ListableMixin
        if hasattr(obj, 'get_list_image'):
            return resolve(obj, "get_list_image")

        logger.warning('ThumbnailAdminMixin.thumbnail_field unspecified')
        return None
829662
def regenerate_thumbs(self):
        
        Model = self.model
        instances = Model.objects.all()
        num_instances = instances.count()
        # Filenames are keys in here, to help avoid re-genning something that
        # we have already done.
        regen_tracker = {}

        counter = 1
        for instance in instances:
            file = getattr(instance, self.field)
            if not file:
                print "(%d/%d) ID: %d -- Skipped -- No file" % (counter,
                                                                num_instances,
                                                                instance.id)
                counter += 1
                continue

            file_name = os.path.basename(file.name)

            if regen_tracker.has_key(file_name):
                print "(%d/%d) ID: %d -- Skipped -- Already re-genned %s" % (
                                                    counter,
                                                    num_instances,
                                                    instance.id,
                                                    file_name)
                counter += 1
                continue

            # Keep them informed on the progress.
            print "(%d/%d) ID: %d -- %s" % (counter, num_instances,
                                            instance.id, file_name)

            try:
                fdat = file.read()
                file.close()
                del file.file
            except IOError:
                # Key didn't exist.
                print "(%d/%d) ID %d -- Error -- File missing on S3" % (
                                                              counter,
                                                              num_instances,
                                                              instance.id)
                counter += 1
                continue

            try:
                file_contents = ContentFile(fdat)
            except ValueError:
                # This field has no file associated with it, skip it.
                print "(%d/%d) ID %d --  Skipped -- No file on field)" % (
                                                              counter,
                                                              num_instances,
                                                              instance.id)
                counter += 1
                continue

            # Saving pumps it back through the thumbnailer, if this is a
            # ThumbnailField. If not, it's still pretty harmless.

            try:
                file.generate_thumbs(file_name, file_contents)
            except IOError, e:
                print "(%d/%d) ID %d --  Error -- Image may be corrupt)" % (
                    counter,
                    num_instances,
                    instance.id)
                counter += 1
                continue

            regen_tracker[file_name] = True
            counter += 1
1094103
def iterator(self, **kwargs):
        
        cls_name = '{0}Collection'.format(self._cls.__name__)
        collection_cls = type(str(cls_name), (ElementCollection,), {})

        params = {'filter_context': self._cls.typeof}
        params.update(kwargs)
        return collection_cls(**params)
681289
protected function getThumbnail()
    {
        if (!$this->_thumbnail) {
            $types = $this->thumbnailTypes;

            if ($this->thumbnailType !== 'auto') {
                array_unshift($types, $this->thumbnailType);
            }

            foreach ($types as $type) {
                $thumb = $this->get('thumbnails.' . $type, false);

                if ($thumb) {
                    $thumb = $thumb instanceof ThumbnailImageMedium ? $thumb : MediumFactory::fromFile($thumb, ['type' => 'thumbnail']);
                    $thumb->parent = $this;
                }

                if ($thumb) {
                    $this->_thumbnail = $thumb;
                    break;
                }
            }
        }

        return $this->_thumbnail;
    }
694226
def preview(src_path):
  ''' 
  '''
  preview = embedded_preview(src_path)

  if not is_valid_preview(preview):
    preview = generator_preview(src_path)

  if not is_valid_preview(preview):
    preview = thumbnail_preview(src_path)

  # Ensure the preview is returned in the right format
  if is_valid_preview(preview):
    if mimetype(preview) in [ExportMimeType.PNG]:
      return [preview]

    if mimetype(preview) in [ExportMimeType.PDF]:
      return to_pngs(preview)

  return []
739526
def _get_next_files(self):
        
        fnlist = self.__files[:16]
        self.__files = self.__files[16:]
        return fnlist
1157595
def get_iterator(self, query, **options):
        """"""
        return EventsPageIterator(self.client, '/events', query, options).items()
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)
984807
public Iterable<DOAuth2User> queryByThumbnailUrl(java.lang.String thumbnailUrl) {
    return queryByField(null, DOAuth2UserMapper.Field.THUMBNAILURL.getFieldName(), thumbnailUrl);
  }
506430
def inputfiles(self, inputtemplate=None):
        """"""
        if isinstance(inputtemplate, InputTemplate):
            #ID suffices:
            inputtemplate = inputtemplate.id
        for inputfile in self.input:
            if not inputtemplate or inputfile.metadata.inputtemplate == inputtemplate:
                yield inputfile
945747
public function actionProcessThumbnails()
    {
        $response = Yii::$app->storage->processThumbnails();
        
        if ($response) {
            return $this->outputSuccess('Successful generated storage thumbnails.');
        }
        
        return $this->outputError('Error while creating the storage thumbnails.');
    }
676356
def avail_images():
    '''
    
    '''
    response = _query('grid', 'image/list')

    ret = {}
    for item in response['list']:
        name = item['friendlyName']
        ret[name] = item

    return ret
1153524
def get_files(client, bucket, prefix=''):
    """"""
    bucket = client.get_bucket(bucket)
    files = list(bucket.list_blobs(prefix=prefix))    
    return files
904454
private Iterable<URL> createServiceFileIterator() {
        if (classLoader == null) {
            ClassLoader classLoader = SchemaFactoryFinder.class.getClassLoader();
            return Collections.singleton(classLoader.getResource(SERVICE_ID));
        } else {
            try {
                Enumeration<URL> e = classLoader.getResources(SERVICE_ID);
                if (debug && !e.hasMoreElements()) {
                    debugPrintln("no "+SERVICE_ID+" file was found");
                }

                // wrap it into an Iterator.
                return Collections.list(e);
            } catch (IOException e) {
                if (debug) {
                    debugPrintln("failed to enumerate resources "+SERVICE_ID);
                    e.printStackTrace();
                }
                return Collections.emptySet();
            }
        }
    }
1278740
def _get_thumbnail_url(image):
    
    lhs, rhs = splitext(image.url)
    lhs += THUMB_EXT
    thumb_url = f'{lhs}{rhs}'
    return thumb_url