mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
209d4220d5
We expose the image resolution related GD functionality to userland by introducing `imageresolution()` as getter/setter. Given only the image argument, it returns the current resolution as indexed array. Given only a second argument, it sets the horizontal and vertical resolution to this value. Given three arguments, it sets the horizontal and vertical resolution to the given arguments, respectively.
43 lines
774 B
PHP
43 lines
774 B
PHP
--TEST--
|
|
Set and get image resolution of PNG images
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('gd')) die('skip gd extension not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$filename = __DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_png.png';
|
|
|
|
$exp = imagecreate(100, 100);
|
|
imagecolorallocate($exp, 255, 0, 0);
|
|
|
|
imageresolution($exp, 71);
|
|
imagepng($exp, $filename);
|
|
$act = imagecreatefrompng($filename);
|
|
var_dump(imageresolution($act));
|
|
|
|
imageresolution($exp, 71, 299);
|
|
imagepng($exp, $filename);
|
|
$act = imagecreatefrompng($filename);
|
|
var_dump(imageresolution($act));
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
array(2) {
|
|
[0]=>
|
|
int(71)
|
|
[1]=>
|
|
int(71)
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
int(71)
|
|
[1]=>
|
|
int(299)
|
|
}
|
|
===DONE===
|
|
--CLEAN--
|
|
<?php
|
|
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'imageresolution_png.png');
|
|
?>
|