WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Image_Editor_Imagick::load() public WP 3.5.0

Loads image from $this->file into new Imagick Object.

Это метод класса: WP_Image_Editor_Imagick{}

Хуков нет.

Возвращает

true/WP_Error. True if loaded; WP_Error on failure.

Использование

$WP_Image_Editor_Imagick = new WP_Image_Editor_Imagick();
$WP_Image_Editor_Imagick->load();

Список изменений

С версии 3.5.0 Введена.

Код WP Image Editor Imagick::load: wp-includes/class-wp-image-editor-imagick.php WP 5.5.1

<?php
public function load() {
	if ( $this->image instanceof Imagick ) {
		return true;
	}

	if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) ) {
		return new WP_Error( 'error_loading_image', __( 'File doesn&#8217;t exist?' ), $this->file );
	}

	/*
	 * Even though Imagick uses less PHP memory than GD, set higher limit
	 * for users that have low PHP.ini limits.
	 */
	wp_raise_memory_limit( 'image' );

	try {
		$this->image    = new Imagick();
		$file_extension = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) );
		$filename       = $this->file;

		if ( 'pdf' === $file_extension ) {
			$filename = $this->pdf_setup();
		}

		// Reading image after Imagick instantiation because `setResolution`
		// only applies correctly before the image is read.
		$this->image->readImage( $filename );

		if ( ! $this->image->valid() ) {
			return new WP_Error( 'invalid_image', __( 'File is not an image.' ), $this->file );
		}

		// Select the first frame to handle animated images properly.
		if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) ) {
			$this->image->setIteratorIndex( 0 );
		}

		$this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
	} catch ( Exception $e ) {
		return new WP_Error( 'invalid_image', $e->getMessage(), $this->file );
	}

	$updated_size = $this->update_size();
	if ( is_wp_error( $updated_size ) ) {
		return $updated_size;
	}

	return $this->set_quality();
}