Imagick example

if ( ! is_file( $this->file ) && ! wp_is_stream( $this->file ) ) {
            return new WP_Error( 'error_loading_image', __( 'File does not 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 ) );

            if ( 'pdf' === $file_extension ) {
                $pdf_loaded = $this->pdf_load_source();

                if ( is_wp_error( $pdf_loaded ) ) {
                    return $pdf_loaded;
                }
            } else {
                if ( wp_is_stream( $this->file ) ) {
                    // Due to reports of issues with streams with `Imagick::readImageFile()`, uses `Imagick::readImageBlob()` instead.


        // Populate the media fields.         $info['wp-media']['fields']['image_editor'] = array(
            'label' => __( 'Active editor' ),
            'value' => _wp_image_editor_choose(),
        );

        // Get ImageMagic information, if available.         if ( class_exists( 'Imagick' ) ) {
            // Save the Imagick instance for later use.             $imagick             = new Imagick();
            $imagemagick_version = $imagick->getVersion();
        } else {
            $imagemagick_version = __( 'Not available' );
        }

        $info['wp-media']['fields']['imagick_module_version'] = array(
            'label' => __( 'ImageMagick version number' ),
            'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ),
        );

        $info['wp-media']['fields']['imagemagick_version'] = array(
            
Home | Imprint | This part of the site doesn't use cookies.