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

Imagick::writeImage

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

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

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

imagick.writeimage.php

Imagick::writeImage

("PECL imagick 2 >= 2.3.0", "PECL imagick 3")

Imagick::writeImageЗапишува слика во наведената датотека

= NULL

public function Imagick::writeImage(string $filename Ги ескејпува специјалните знаци во): bool

(PECL imagick 2 >= 2.0.0, PECL imagick 3)

Параметри

filename

Ја пишува сликата на наведената датотека. Ако параметарот filename е NULL, сликата се пишува на датотеката поставена од Imagick::readImage() или Imagick::setImageFilename().

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

Патеката до PHP скриптата што треба да се провери. true на успешен исход.

Белешки од корисници 4 белешки

SkepticaLee
12 години пред
When running Imagick as packaged with the Abyss Web Server, neither this method nor writeImages () works. Instead the format has to be declared and the file saved by using another method or procedure, e.g.:

<?php
$im = new Imagick ();
$im->newImage (300, 225, "blue");
$im->writeImage ("test_0.jpg"); // fails with no error message
//instead
$im->setImageFormat ("jpeg");
file_put_contents ("test_1.jpg", $im); // works, or:
$im->imageWriteFile (fopen ("test_2.jpg", "wb")); //also works
?>
daniel at justathought dot dev
пред 15 години
If you are trying to manipulate a uploaded file and then save the file all in the same request with Apache + mod_dav this will fail.
mod_dav puts a lock on the file during the request where the file is uploaded so trying to save the smallest file, e.g. 1kb will fail with a "Failed to allocate memory" error.
icinagle at gmail dot com
пред 13 години
With Imagick 3.1.0RC2, PHP4.8
If you plan to overwrite the file you're working on, before doing writeImage, consider clearing the file buffer before the write statement : 

<?php
$image = new Imagick($your_file);
/* some processing */

clearstatcache(dirname($your_file));
// or
unlink($your_file);
$image->writeImage($your_file);
?>
It happened to me that the resulting file size was wrong. This could lead to truncation, as the file is not expanded.
This happened while working on JPEG, and PNG. 

this line worked for me without this hack. 
<?php
file_put_contents($your_file, $image);
?>

Do not rely on getImageLength() for sending your image, especially when keepalive is ON. Content length is then relevant, and must be set. If the wrong size is given, your image will be truncated.
Use filesize($your_file_) once written or strlen($image) instead (which renders your image and updates getImageLength() result).
Навигација

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

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

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

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

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

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

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