/*
ajax_get_images

@description:
@since: 3.5.7
@created: 13/01/13
962075
function ajax_get_images()
   	{
   		// vars
		$options = array(
			'nonce' => '',
			'images' => array(),
			'preview_size' => 'thumbnail'
		);
		$return = array();
		
		
		// load post options
		$options = array_merge($options, $_POST);
		
		
		// verify nonce
		if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') )
		{
			die(0);
		}
		
		
		if( $options['images'] )
		{
			foreach( $options['images'] as $id )
			{
				$url = wp_get_attachment_image_src( $id, $options['preview_size'] );
				
				
				$return[] = array(
					'id' => $id,
					'url' => $url[0],
				);
			}
		}
		
		
		// return json
		echo json_encode( $return );
		die;
		
   	}
925323
function getImageItem() {
  var item = document.createElement('li');
  item.className = 'is-loading';
  var img = document.createElement('img');
  var size = Math.random() * 3 + 1;
  var width = Math.random() * 110 + 100;
  width = Math.round( width * size );
  var height = Math.round( 140 * size );
  var rando = Math.ceil( Math.random() * 1000 );
  // 10% chance of broken image src
  // random parameter to prevent cached images
  img.src = rando < 100 ? '//foo/broken-' + rando + '.jpg' :
    // use picsum for great random images
    'https://picsum.photos/' + width + '/' + height + '/' + '?random';
  item.appendChild( img );
  return item;
}
1070359
public function gettyimagesToHtml()
    {
        return $this->view('image.gettyimages', [
            'remote_id' => $this->data['remote_id'],
            'width' => $this->config['gettyimages.width'] ?? 594,
            'height' => $this->config['gettyimages.height'] ?? 465,
            'placeholder' => $this->config['gettyimages.placeholder'] ?? '/',
        ]);
    }
1133645
private function checkImageTitleTags() {

        $html = $this->getPageContent();

        // for newly created page
        if ($html == '') {
            return false;
        }

        $dom = $this->createDOMDocumentFromHTML($html);

        $images = $dom->getElementsByTagName('img');

        $imagesWithTitleTags = 0;
        foreach($images as $image){
            if($image->hasAttribute('title') && $image->getAttribute('title') != ''){
                //echo $image->getAttribute('title') . '<br>';
                $imagesWithTitleTags++;
            }
        }

        if($imagesWithTitleTags == $images->length){
            return true;
        }

        return false;
    }
139628
public function ajax_image_fetch($nonce)
    {
        header('content-type: application/json; charset=utf-8');
        // check for $nonce first
        if(!wp_verify_nonce($nonce, 'boots_form_image_fetch'))
        {
            die(json_encode(array('error'=>'insecure access')));
        }
        // good to go

        if(!array_key_exists('id', $_POST))
        {
            die(json_encode(array('error'=>'invalid image id')));
        }

        $id = esc_attr($_POST['id']);
        $width = esc_attr($_POST['width']);
        $height = esc_attr($_POST['height']);

        // Response['url'] Response['width'] Response['height']
        $Response = $this->Boots->Media
                    ->image($id)
                        ->width($width)
                        ->height($height)
                        ->get(true); // array

        // return response
        die(json_encode($Response));
    }
432245
public function getImages(ImagesQuery $query = null) {
        if (!$query) {
            $query = new ImagesQuery();
        }

        $params = array(
            'user' => $this->getUser(),
            'page' => $query->page(),
            'limit' => $query->limit(),
        );

        if ($query->metadata()) {
            $params['metadata'] = true;
        }

        if ($from = $query->from()) {
            $params['from'] = $from;
        }

        if ($to = $query->to()) {
            $params['to'] = $to;
        }

        if ($fields = $query->fields()) {
            $params['fields'] = $fields;
        }

        if ($sort = $query->sort()) {
            $params['sort'] = $sort;
        }

        if ($ids = $query->ids()) {
            $params['ids'] = $ids;
        }

        if ($checksums = $query->checksums()) {
            $params['checksums'] = $checksums;
        }

        if ($originalChecksums = $query->originalChecksums()) {
            $params['originalChecksums'] = $originalChecksums;
        }

        $response = $this->getCommand('GetImages', $params)->execute();
        $response['images'] = array_map(
            array('ImboClient\Helper\PublicKeyFallback', 'fallback'),
            $response['images']
        );

        return $response;
    }
9567
def get_all_image_lists(custom_headers:nil)
      response = get_all_image_lists_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
855965
public function callbackLoadAllImages()
    {
        $query = (new Query())
            ->select(['image_id' => $this->imageIdFieldName])
            ->where([$this->refFieldName => $this->getItemId()])
            ->from($this->refTableName);
        
        if ($this->isSortEnabled()) {
            $query->orderBy([$this->sortIndexFieldName => SORT_ASC]);
        }
            
        $data = $query->all();
        $images = [];
        foreach ($data as $image) {
            $images[] = $this->getImageArray($image['image_id']);
        }

        return $images;
    }
739712
function loadImage ($imageElement, newSource, callback) {
        $imageElement.fadeOut(function () {
            $imageElement.attr("src", newSource);
            imgLoad($imageElement, function () {
                $imageElement.removeClass("loading");
                $imageElement.fadeIn();
                if (typeof callback === "function") {
                    callback();
                }
            });
        });
    }
351314
public function getImages()
    {
        // Sort array
        $images = array();
        if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) {
            $images[self::IMAGE_HEADER_LEFT] =         $this->headerFooterImages[self::IMAGE_HEADER_LEFT];
        }
        if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) {
            $images[self::IMAGE_HEADER_CENTER] =     $this->headerFooterImages[self::IMAGE_HEADER_CENTER];
        }
        if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
            $images[self::IMAGE_HEADER_RIGHT] =     $this->headerFooterImages[self::IMAGE_HEADER_RIGHT];
        }
        if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
            $images[self::IMAGE_FOOTER_LEFT] =         $this->headerFooterImages[self::IMAGE_FOOTER_LEFT];
        }
        if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
            $images[self::IMAGE_FOOTER_CENTER] =     $this->headerFooterImages[self::IMAGE_FOOTER_CENTER];
        }
        if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
            $images[self::IMAGE_FOOTER_RIGHT] =     $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT];
        }
        $this->headerFooterImages = $images;

        return $this->headerFooterImages;
    }
82776
public function getHeaders()
    {
        switch ($this->request->ext) {
            case 'jpg':
            case 'jpeg':
                $this->response->headerController->headerField('Content-Type', 'image/jpeg');
                break;
            case 'png':
                $this->response->headerController->headerField('Content-Type', 'image/png');
                break;
            case 'gif':
                $this->response->headerController->headerField('Content-Type', 'image/gif');
                break;
        }
    }
558761
def avail_images(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-images option'
        )

    fetch = True
    page = 1
    ret = {}

    while fetch:
        items = query(method='images', command='?page=' + six.text_type(page) + '&per_page=200')

        for image in items['images']:
            ret[image['name']] = {}
            for item in six.iterkeys(image):
                ret[image['name']][item] = image[item]

        page += 1
        try:
            fetch = 'next' in items['links']['pages']
        except KeyError:
            fetch = False

    return ret
764817
public function images()
    {
        foreach($this->data as $post)
        {
            $post->images = Post::images($post->ID);
        }

        return $this;
    }
537107
public function enaImageFiles()
    {
        $properties = $this->getProperties();
        $extString  = (!empty($properties['acceptedFiles'])) ? $properties['acceptedFiles'] : '';
        $imagExts   = $this->getImageExtensionConstant();
        foreach ($imagExts as $imagExt) {
            if (in_array($imagExt, $extString) === false) {
                $extString[] = $imagExt;
            }
        }
        $properties                     = $this->getProperties();
        $properties['acceptedFiles']    = $extString;
        $this->setProperties($properties);
        return $this;
    }
952583
private function get_images( $args = array(), $additional_mime_types = array() ) {
		$mime_types = array_merge( array( 'image' ), $additional_mime_types );

		$query_args = array(
			'post_type'      => 'attachment',
			'post__in'       => $args,
			'post_mime_type' => $mime_types,
			'post_status'    => 'any',
			'posts_per_page' => -1,
		);

		return new WP_Query( $query_args );
	}
592158
function ajax_get_files()
   	{
   		// vars
		$options = array(
			'nonce' => '',
			'files' => array()
		);
		$return = array();
		
		
		// load post options
		$options = array_merge($options, $_POST);
		
		
		// verify nonce
		if( ! wp_verify_nonce($options['nonce'], 'acf_nonce') )
		{
			die(0);
		}
		
		
		if( $options['files'] )
		{
			foreach( $options['files'] as $id )
			{
				$o = array();
				$file = get_post( $id );
					
				$o['id'] = $file->ID;
				$o['icon'] = wp_mime_type_icon( $file->ID );
				$o['title']	= $file->post_title;
				$o['size'] = size_format(filesize( get_attached_file( $file->ID ) ));
				$o['url'] = wp_get_attachment_url( $file->ID );
				$o['name'] = end(explode('/', $o['url']));				
				
				$return[] = $o;
			}
		}
		
		
		// return json
		echo json_encode( $return );
		die;
		
   	}
316334
private function getImage()
    {
        $image = $this->_parser->find('#content table tr', 0)->find('td', 0)->find('img', 0);

        return $image ? $image->src : '';
    }