getimagesize
laravel/framework
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the size of an image
getimagesize
(
string $filename
, array &
$image_info
=
null
): array|
false
return
true
;
}
if (!
$this
->
isValidFileInstance
(
$value
) || !
$sizeDetails
= @
getimagesize
(
$value
->
getRealPath
())) {
return
false
;
}
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
$image
= (new
FileFactory
)->
image
(
'test.png'
,
15
,
20
);
$info
=
getimagesize
(
$image
->
getRealPath
());
$this
->
assertSame
(
'image/png'
,
$info
[
'mime'
]);
$this
->
assertSame
(
15
,
$info
[
0
]);
tests/Http/HttpTestingFileFactoryTest.php
$jpeg
= (new
FileFactory
)->
image
(
'test.jpeg'
,
15
,
20
);
$jpg
= (new
FileFactory
)->
image
(
'test.jpg'
);
$info
=
getimagesize
(
$jpeg
->
getRealPath
());
$this
->
assertSame
(
'image/jpeg'
,
$info
[
'mime'
]);
$this
->
assertSame
(
15
,
$info
[
0
]);
tests/Http/HttpTestingFileFactoryTest.php
$this
->
assertSame
(
'image/vnd.wap.wbmp'
,
getimagesize
(
$image
->
getRealPath
())[
'mime'
]
);
}
tests/Http/HttpTestingFileFactoryTest.php
$this
->
assertSame
(
'image/x-ms-bmp'
,
mime_content_type
(
$imagePath
));
$this
->
assertSame
(
'image/bmp'
,
getimagesize
(
$imagePath
)[
'mime'
]);
}
public function
testCreateWithMimeType
()
tests/Http/HttpTestingFileFactoryTest.php