首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

getimagesizefromstring

(PHP 5 >= 5.4.0, PHP 7)

getimagesizefromstring — Get the size of an image from a string

Description

代码语言:javascript
复制
array getimagesizefromstring ( string $imagedata [, array &$imageinfo ] )

Identical to getimagesize() except that getimagesizefromstring() accepts a string instead of a file name as the first parameter.

See the getimagesize() documentation for details on how this function works.

Parameters

imagedata

The image data, as a string.

imageinfo

See getimagesize().

Return Values

See getimagesize().

Examples

Example #1 getimagesizefromstring() example

代码语言:javascript
复制
<?php
$img = '/path/to/test.png';

// Open as a file
$size_info1 = getimagesize($img);

// Or open as a string
$data       = file_get_contents($img);
$size_info2 = getimagesizefromstring($data);
?>

See Also

  • getimagesize() - Get the size of an image

← getimagesize

image_type_to_extension →

代码语言:txt
复制
 © 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券