No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

Imagick::thumbnailImage

(PECL imagick 2.0.0)

Imagick::thumbnailImageChanges the size of an image

Description

Imagick::thumbnailImage ( int $columns , int $rows [, bool $bestfit = FALSE [, bool $fill = FALSE [, bool $legacy = FALSE ]]] ) : bool

Changes the size of an image to the given dimensions and removes any associated profiles. The goal is to produce small, low cost thumbnail images suited for display on the Web. If TRUE is given as a third parameter then columns and rows parameters are used as maximums for each side. Both sides will be scaled down until they match or are smaller than the parameter given for the side.

Note: The behavior of the parameter bestfit changed in Imagick 3.0.0. Before this version given dimensions 400x400 an image of dimensions 200x150 would be left untouched. In Imagick 3.0.0 and later the image would be scaled up to size 400x300 as this is the "best fit" for the given dimensions. If bestfit parameter is used both width and height must be given.

PHP: Imagick::thumbnailImage - Manual Home of Manuel PHP  Contents Haut

Parameters

columns

Image width

rows

Image height

bestfit

Whether to force maximum values

PHP: Imagick::thumbnailImage - Manual Home of Manuel PHP  Contents Haut

Errors/Exceptions

Throws ImagickException on error.

PHP: Imagick::thumbnailImage - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 Imagick::thumbnailImage()

<?php
function thumbnailImage($imagePath) {
    
$imagick = new \Imagick(realpath($imagePath));
    
$imagick->setbackgroundcolor('rgb(64, 64, 64)');
    
$imagick->thumbnailImage(100100truetrue);
    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

?>

Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-imagick.thumbnailimage.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut