Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imagescale

Description

The imagescale of Image for PHP scale an image using the given new width and height.

Syntax

imagescale(
    GdImage $image,
    int $width,
    int $height = -1,
    int $mode = IMG_BILINEAR_FIXED
): GdImage|false

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

width

The width to scale the image to.

height

The height to scale the image to. If omitted or negative, the aspect ratio will be preserved.

mode

One of IMG_NEAREST_NEIGHBOUR, IMG_BILINEAR_FIXED, IMG_BICUBIC, IMG_BICUBIC_FIXED or anything else (will use two pass).

Note: IMG_WEIGHTED4 is not yet supported.

Return

Return the scaled image object on success or false on failure.

Examples

1 · return

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$return = imagescale($image, $width);

var_dump($return);

?>
object(GdImage)#2 (0) {
}

2 · base64 · image width

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$image = imagescale($image, $width);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAIf0lEQVR4nO3dYXLiOBAF4E52DrI3oW+G9yZ7lJebzJ6E/aEiJcYWkW211C2/r+YHxVAg8MujTRz88Xg85EIWkX9GPO5dZBnxuMP8Gr0AIxBB4fohUAiWimjPdXQzcbCGNFPJl8hX4b+05zq6mSNYWFURNm7lEVZNpnNEbZpgueqneptNpv3X0VzEYCFsP9XAHB0WNFhB+6nGJB0WJVjIagnFW80JWYdplJAFCtbELfXeHx2mo9axi+dg4cItVYIo7eU8WJdtqZIw7eUtWGBLVYPn9nIYLLZUJdft9Tl6Ad8gsrCljoK3V89PY4FddcJ3e+nYdXwbGyxwomoKfqau4cFi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NWuoWLH1eXhis7rRPS+X6HzajIsLe6qXTRLU2JFjK3upF+3dVMupAPxUR9palYV2VDAyWsrcs6aiuSsYemqzZZTBkpw3Y+ysZHix9Xl4YrNN0bEvl/PwxhYoIe+uowRPVmqtgKXvrKPXTVYmfYCWaXQZD9pajiWrNYbD0eXlhsN5Sby2V8xasnGaXwZCJiPOWyjkPlj4vLwyWiDhvqZznYOU0u4yLhSxMS+UCBUufl5eLBUujtFQuSrByuroGE0XttnqCunUz74IGS1+vWSYKlkbsp7WIwVrT1TUIErVJ+mltmmDp6zVLkGDpHP20Nkew1rRwPQYFbt1MyeaVM5g4WLp1/TIoWDprM5V8jl5AZzrocTHocYf5HwDbgtRKuDSTAAAAAElFTkSuQmCC">
</body>
</html>

3 · base64 · height

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$height = 300;
$image = imagescale($image, $width, $height);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAEsCAIAAAAJmGvpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAYkUlEQVR4nO2d65Mc1XnGf/tqdcMCXKlQ2CCJi1aX2V1JYBubJK4ElxMHZC4CtFwkJcb5nm8ul7mKOy6X/4RUjBNJgBZJCCFjbFOEuCplG5uL2NmVtKsLuiQgEFgSYrVa7Tv5cNSuXs/Mbs90nz6nZ8/z4VdNM9P9nD7nPHPe7tVMW6VSYQrpYXjExXnXwcMuzutM7YCqikhrsU9kQLUi0jaeZRFUyZ1lkd5afkoi3a6vlRW2tWhi9UJvrf1l6M/bC0AndNXa3wM9eXvJR5VKZWxsrOX4UKXC2Bje8yEPrpUVtkZi9Vfl0KY6ieWbeuCO8Xs6odONl0zVGmusPpHNfqyl0q+9bhf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V0mtiep1ScfqcWKMwGm0/AU+69OKL7oP7o+3pMN2llwnlc2JNg/NUZ8F5qiVYoXoDrFDtwH1y5MmOWNtLsWsyzYM+KmRixfU2vB1tvwDbXHrJW7fAymj7KrjKpZfE8jmx4pzK663CrKviLEpixbUBNozfMwhDbrxkrw5YOH7PGljjxksKpf9livxpfgsj/qsQL4gMqRe/7JDJb0OsHN+6UvrficifRUysM3Bm/J4n4Sk3XrLXvXDf+D0zYIYbLylUxMRqF5lRlWHXj5/lgyJ7XWdPEi4QWViVT3OqWl24PipkYlXrLXhr/J5t8KIbL43pZrhl/J6r4Wo3XjJVEROr5qqroyqxXnSdRsl/bSvufHoR86lVE6ta62F9rf1DsDdvLwALoKPW/rWwNm8vuag1EqtmhvXU+lXBbY7WXp0it9TyU8iKbyon1giM1Nr/FPwwby8AP4B7a+2fCTPz9pKLinLnvVFOhwtU51TR1e9lHKrjZ7oH18oK/x8x7k1389gYHQAAAABJRU5ErkJggg==">
</body>
</html>

4 · base64 · mode · IMG_NEAREST_NEIGHBOUR

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$height = 300;
$mode = IMG_NEAREST_NEIGHBOUR;
$image = imagescale($image, $width, $height, $mode);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAEsCAIAAAAJmGvpAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF8UlEQVR4nO3d226jWBRF0Uor///L7gfU1SiOE1+YcA4e47lUwWRpL2+MycflcvnzXj4O+rnvdZ7/OfoAOCfBIiFYJD6PPoDOUe+lbrl1POd872VikRAsEqepwtGK737XR36GcjSxSAgWiUmrcN7iu8cZytHEIiFYJCaqwnPX38/Wr32OWjSxSAgWicGr8J3r75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tc2A23MsrbGBOLhGCRGKQKFwrxFaOU4MLEIiFYJL6tQpdJud/3b11MLBKCRWKorXBhN3zUiG9aTCwSgkXihyo8djdUiPc4tgR/+u2YWCQEi8SAW+GaQrxlxE1wzcQiIVgkfq3CET43VIhrI5Tg778LE4uEYJEYfCtcU4gjlOC9TCwSgkXiziocYTdcrI/hHWpxhHO+du85N7FICBaJh7bCcQpxce49cZzzvHjsPJtYJASLxEQXSG850544Wv09z8QiIVgknqjC0XbDtRlrccwzufbMmTSxSAgWiae3wpELcTFyLY583taeP28mFgnBIvHiBdLxC3FxfYR7luP45+faq+fHxCIhWCRO8Fnhc27V0ysVMGPlVUwsEoJFYpMqnGU3vMc5XsUrttmXTSwSgkViw63wTIX4nra8aGxikRAsEptfIFWIM9r+k1MTi4RgkRAsEtGH0N5pzaK6L83EIiFYJNL7sRTiyNqbs00sEoJFYodbkxXiaPb4hpKJRUKwSOz2LZ31+FWL+9v76RUmFgnBInHIF1btiXs65hFOJhYJwSJx4LMbFGLtyOcYmlgkBIvE4Y8xcuF0W6M8xtfEIiFYJA6vwjV74itGKcGFiUVCsEgMVYULe+L9xqq/NROLhGCRGLAK19TitXHrb83EIiFYJAavwrV3rsU56m/NxCIhWCQmqsK162o4UznOV3zXTCwSgkVi0iq8Nm85nqH4rplYJASLxGmq8NqtijmqIs9Zebf8C5Sgks+rnCHLAAAAAElFTkSuQmCC">
</body>
</html>

5 · base64 · mode · IMG_BILINEAR_FIXED

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$height = 300;
$mode = IMG_BILINEAR_FIXED;
$image = imagescale($image, $width, $height, $mode);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAEsCAIAAAAJm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WoKVqouj/YFWuRhWqpZi15/EvVaAxIrLfJeB/99f0Boy31uR53dVnFM+iRVnqBPzZE41YDXzTyyjZ+FZ2AW7XZx9KmgxLIG74C4np88/sUJu5UNnWYXTxBqDMXgMHndx9qmgB+BBmAbTnJzeVWK1wQzVEtysehPcrLoI97O86FwUu54lmKHa5qh/nSWWkf/fcl4sefRN964SyzDckc+WDu6w16PbxIrrGXgGdsMe106KqEWwGO6Gu107OSe3iVWdXiG3mqPjGrCa/iTWWTgLj8MTrp0UUffDA9BuvpfKB/mTWBL71eFvw42qC3GfBD5zYexamV/s9qc3PUosI/NbyEb+/CKyn1oZ+4Vm734b26MxDoQ6sRF6VANW07fEimsjbIy298CgSy++aCEsirZXw2qXXiaUb4kV0mtiep1ScfqcWKMwGm0/AU+69OKL7oP7o+3pMN2llwnlc2JNg/NUZ8F5qiVYoXoDrFDtwH1y5MmOWNtLsWsyzYM+KmRixfU2vB1tvwDbXHrJW7fAymj7KrjKpZfE8jmx4pzK663CrKviLEpixbUBNozfMwhDbrxkrw5YOH7PGljjxksKpf9livxpfgsj/qsQL4gMqRe/7JDJb0OsHN+6UvrficifRUysM3Bm/J4n4Sk3XrLXvXDf+D0zYIYbLylUxMRqF5lRlWHXj5/lgyJ7XWdPEi4QWViVT3OqWl24PipkYlXrLXhr/J5t8KIbL43pZrhl/J6r4Wo3XjJVEROr5qqroyqxXnSdRsl/bSvufHoR86lVE6ta62F9rf1DsDdvLwALoKPW/rWwNm8vuag1EqtmhvXU+lXBbY7WXp0it9TyU8iKbyon1giM1Nr/FPwwby8AP4B7a+2fCTPz9pKLinLnvVFOhwtU51TR1e9lHKrjZ7oH18oK/x8x7k1389gYHQAAAABJRU5ErkJggg==">
</body>
</html>

6 · base64 · mode · IMG_BICUBIC

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$height = 300;
$mode = IMG_BICUBIC;
$image = imagescale($image, $width, $height, $mode);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>

7 · base64 · mode · IMG_BICUBIC_FIXED

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png';
$image = imagecreatefrompng($filename);

$width = 200;
$height = 300;
$mode = IMG_BICUBIC_FIXED;
$image = imagescale($image, $width, $height, $mode);

ob_start();

    imagepng($image);

$output = ob_get_clean();

echo '<!doctype html>
<html>
<body>
    <img src="data:image/png;base64,' . base64_encode($output) . '">
</body>
</html>';

?>
HomeMenu