PHP.mk документација

Imagick::getFormat

Почист и полокален преглед на PHP референцата, со задржана структура од PHP.net и подобра читливост за примери, секции и белешки.

imagick.getformat.php PHP.net прокси Преводот се освежува
Оригинал на PHP.net
Патека imagick.getformat.php Локална патека за оваа страница.
Извор php.net/manual/en Оригиналниот HTML се реупотребува и локално се стилизира.
Режим Прокси + превод во позадина Кодовите, табелите и белешките остануваат читливи во истиот тек.
Imagick::getFormat

Референца за `imagick.getformat.php` со подобрена типографија и навигација.

imagick.getformat.php

Imagick::getFormat

(PECL imagick 2, PECL imagick 3)

Imagick::getFormatReturns the format of the Imagick object

= NULL

public Imagick::getFormat(): string

Returns the format of the Imagick object.

Параметри

Оваа функција нема параметри.

Вратени вредности

Returns the format of the image.

Errors/Exceptions

Фрла ImagickException при грешка.

Белешки од корисници 2 забелешки

Keisial на gmail точка com
пред 13 години
The getFormat function merely returns the value of the image format, which is not automatically loaded when you read an image.  The value you're getting back, then, is merely the value that you set the format to using the setFormat function.  That function takes pretty much any string that matches a popular or well-known image filename.  It accepts "jpeg" and "gif", but errors out on anything that is not an image filename, like "xyz123" or "zip".  How do you know what filetypes you can enter?  Use the PHP ImageMagick function 'queryFormats'.  If you want to know what type of file you have, you should try using the PHP page for the function 'filetype'.  Or, on the other hand, you can use the ImageMagick function getImageFormat (as opposed to the ImageMagick function getFormat).  The difference is that getImageFormat actually returns the format of the inputted image.

And now, a simple demonstration of the set/get activity in the Format :

<?php

            // Author: [email protected]
    
        // Imagick Type
        // ---------------------------------------------

    $imagick_type = new Imagick();
    
        // Open File
        // ---------------------------------------------
        
    $file_to_grab = "image_workshop_directory/test.bmp";
    
    $file_handle_for_viewing_image_file = fopen($file_to_grab, 'a+');
    
        // Grab File
        // ---------------------------------------------

    $imagick_type->readImageFile($file_handle_for_viewing_image_file);
    
        // Set/Get Format
        // ---------------------------------------------
        
    $imagick_type->setFormat("bmp");
    $imagick_type_format = $imagick_type->getFormat();
    
        // Print Results
        // ---------------------------------------------

    print("<pre>");
    print($imagick_type_format);
    print("</pre>");

?>
Test
пред 6 години
This example doesn't work for the files that have been incorrectly saved or corrupted and have (jpg extension but the image is png)
Навигација

Прелистувај сродни теми и функции.

На оваа страница

Автоматски outline од активната документација.

Насловите ќе се појават тука по вчитување.

Попрегледно читање

Примерите, changelog табелите и user notes се визуелно издвоени за да не се губат во долгата содржина.

Брз совет Користи го outline-от Скокни директно на главните секции од активната страница.
Извор Оригиналниот линк останува достапен Кога ти треба целосен upstream context, отвори го PHP.net во нов tab.