Returns the size of an image.

@param string $url The URL of the image
@return array|false Returns an array with width and height of the image or FALSE on error.
433248
protected function getImageSize($url)
    {
        $request = $this->http->get($url, [
            'Range' => 'bytes=0-32768'
        ]);

        if (!$request->success) {
            return false;
        }

        return getimagesizefromstring($request->data);
    }
536791
public function image($url)
    {
        list($width, $height) = getimagesize($url);
        $this->pdf->Image($url, '', '', 100);
    }
480313
public static function get( $url )
	{
		$checksum	= "6".self::calculateChecksum( self::strord( "info:".$url ) );
		$googleUrl	= "www.google.com/search?client=navclient-auto&ch=".$checksum."&features=Rank&q=info:".$url;
		$curl		= new Net_CURL( $googleUrl );
		$response	= $curl->exec();
		$position	= strpos( $response, "Rank_" );
		if( $position === FALSE )
			throw new Exception( 'Response does not contain Rank.' );
		$pagerank = substr( $response, $position + 9 );
		return (int) $pagerank;
	}
408211
protected function getResize()
    {
        $resize = false;
        $imagePath = $this->getImagePath();
        if ($imagePath) {
            $imageSize = $this->getImageSize($imagePath);

            if ($imageSize['width'] > $this->getWidth() ||
                $imageSize['height'] > $this->getHeight()
            ) {
                $resize = true;
            }
        }

        return $resize;
    }
266900
public function getScaledImage(
        File $file,
        $urlType = 'default',
        $width = null,
        $height = null,
        $filename = null,
        $quality = null
    ) {

        if ($width != null && $height != null) {
            return $this->getResizedImage($file, $urlType, $width, $height, false, $filename, $quality);
        }

        if ($this->mustBuildImage($file, $filename) || $filename == null) {
            $binary = $this->getBinary($file);

            if ($binary) {
                $imagine = new Imagine();
                $image   = $imagine->load($binary);

                $size  = $image->getSize();
                $ratio = $size->getWidth() / $size->getHeight();

                if ($width == null) {
                    $width = $height * $ratio;
                } else {
                    $height = $width / $ratio;
                }

                $filename = $this->determineFileName($file, $width, $height, 's', $filename);
                if ($this->mustBuildImage($file, $filename)) {
                    if ($this->keepOriginalImage($binary, $width, $height)) {
                        return $this->getOriginalImage($file, $urlType, $filename);
                    }

                    $image->resize(new Box($width, $height));

                    $quality = $this->determineQuality($quality);
                    $image->save($this->basePath . '/' . $filename, array('quality' => $quality));
                }

            } else {
                return false;
            }
        }

        $url = $this->baseUrl . '/' . $filename;

        $file->addUrl($urlType, $url);

        return $file;
    }
288183
public static function getImageDimensions($width=false, $height=false) {

		$max_width  = config('center.img.max.width');
		$max_height = config('center.img.max.height');
		$max_area   = config('center.img.max.area');

		//too wide?
		if ($width && $width > $max_width) {
			if ($height) $height *= $max_width / $width;
			$width = $max_width;
		}

		//too tall?
		if ($height && $height > $max_height) {
			if ($width) $width *= $max_height / $height;
			$height = $max_height;
		}

		//not specified?
		if (!$width) $width = config('center.img.default.width');
		if (!$height) $height = config('center.img.default.height');

		//too large?
		$area = $width * $height;
		if ($width * $height > $max_area) {
			$width *= $max_area / $area;
			$height *= $max_area / $area;
		}

		return array($width, $height);
	}
675200
public static function getHeaderFromUrl($url) {
		// @codingStandardsIgnoreStart
		$url = @parse_url($url);
		// @codingStandardsIgnoreEnd
		if (empty($url)) {
			return false;
		}

		$url = array_map('trim', $url);
		$url['port'] = (!isset($url['port'])) ? '' : (':' . (int)$url['port']);
		$path = (isset($url['path'])) ? $url['path'] : '';

		if (empty($path)) {
			$path = '/';
		}

		$path .= (isset($url['query'])) ? "?$url[query]" : '';

		$defaults = [
			'http' => [
				'header' => "Accept: text/html\r\n" .
					"Connection: Close\r\n" .
					"User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64)\r\n",
			]
		];
		stream_context_get_default($defaults);

		if (isset($url['host']) && $url['host'] !== gethostbyname($url['host'])) {
			$url = "$url[scheme]://$url[host]$url[port]$path";
			$headers = get_headers($url);
			if (is_array($headers)) {
				return $headers;
			}
		}
		return false;
	}
817969
public function get_url( $size ) {
		$url = null;
		if ( isset( $this->struct['return_type'] ) && 'url' === $this->struct['return_type'] ) {
			$url = $this->get_value();
		} else {
			$data = wp_get_attachment_image_src( $this->get_value(), $size );
			if ( ! empty( $data ) ) {
				$url = $data[0];
			}
		}

		return $url;
	}
542269
function size($filename)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }

        $result = $this->stat($filename);
        if ($result === false) {
            return false;
        }
        return isset($result['size']) ? $result['size'] : -1;
    }
1343257
public static function imageSizes($size = false)
    {
        global $_wp_additional_image_sizes;
        $additionalSizes = $_wp_additional_image_sizes;

        $sizes = [];
        $imageSizes = get_intermediate_image_sizes();

        foreach($imageSizes as $imageSize)
        {
            if(in_array($imageSize, ['thumbnail', 'medium', 'large']))
            {
                $sizes[$imageSize] = (object) [
                    'name' => $imageSize,
                    'width' => get_option($imageSize . '_size_w'),
                    'height' => get_option($imageSize . '_size_h'),
                    'crop' => (bool) get_option($imageSize . '_crop')
                ];
            }
            elseif(isset($additionalSizes[$imageSize]))
            {
                $sizes[$imageSize] = (object) [
                    'name' => $imageSize,
                    'width' => $additionalSizes[$imageSize]['width'],
                    'height' => $additionalSizes[$imageSize]['height'],
                    'crop' => $additionalSizes[$imageSize]['crop']
                ];
            }
        }

        if($size)
        {
            if(isset($sizes[$size]))
            {
                return $sizes[$size];
            }
            else
            {
                return false;
            }
        }

        return $sizes;
    }
66314
public function shortUrl($url)
    {
        $data = array();
        $data['long_url'] = $url;
        $result = $this->getArrayResult($data, self::MCH_BASE_URL . '/tools/shorturl');
        if (!$result || $result['return_code'] !== 'SUCCESS') {
            $this->errCode = $result['return_code'];
            $this->errMsg = $result['return_msg'];
            return false;
        }
        if (isset($result['err_code']) && $result['err_code'] !== 'SUCCESS') {
            $this->errMsg = $result['err_code_des'];
            $this->errCode = $result['err_code'];
            return false;
        }
        return $result['short_url'];
    }
512452
def get_image_dimension(self, url):
        
        w_h = (None, None)
        try:
            if url.startswith('//'):
                url = 'http:' + url
            data = requests.get(url).content
            im = Image.open(BytesIO(data))

            w_h = im.size
        except Exception:
            logger.warning("Error getting image size {}".format(url), exc_info=True)

        return w_h
545860
public static function getParamsAsArray($url)
    {
        $query = parse_url($url, PHP_URL_QUERY);
        if (!$query) {
            return [];
        }
        $params = [];
        parse_str($query, $params);

        return $params;
    }
54579
public static function get_thumbnail_size() {
		$sizes = self::get_image_sizes();

		if ( isset( $sizes['thumbnail'] ) ) {
			return $sizes['thumbnail'];
		}

		$img_size = reset( $sizes );

		return $img_size;
	}
5863
public function getImageSize($Image = null) {
		$Image = $this->_getImage($Image);
		$BoxInterface = $Image->getSize($Image);
		return [
			$BoxInterface->getWidth(),
			$BoxInterface->getHeight(),
			'x' => $BoxInterface->getWidth(),
			'y' => $BoxInterface->getHeight()
		];
	}
727157
protected function getSize($file)
    {
        if (! file_exists($file)) {
            return [];
        }

        $info = pathinfo($file);
        $image = null;
        switch (strtolower($info['extension'])) {
            case 'gif':
                $image = imagecreatefromgif($file);
                break;
            case 'jpg':
            case 'jpeg':
                $image = imagecreatefromjpeg($file);
                break;
            case 'png':
                $image = imagecreatefrompng($file);
                break;
            default:
                break;
        }
        if ($image == null) {
            return [];
        } else {
            return [imagesx($image), imagesy($image)];
        }
    }
1330789
public function getVideoThumbnail($url) {
        // check for vimeo, I don't like the way Embed returns the Vimeo thumbnail
        if($this->getInfo($url)->type == 'video' && $this->isVimeo($url))
        {
            $id = $this->getVimeoId($url);
            
            $data = file_get_contents("http://vimeo.com/api/v2/video/$id.json");
            $data = json_decode($data);
            
            $image = $this->cleanUrl($data[0]->thumbnail_large);
            
            return $image;
        }
        else
        {
            // not vimeo, use Embed
            $image = $this->cleanUrl($this->getInfo($url)->image);
            
            // Check if anything exists
            if (!empty($image)) {
                return $image;
            }
            else
            {
                return '';
            }
        }
    }