imagetruecolortopalette example

if ( ! $filename ) {
            $filename = $this->generate_filename( null, null, $extension );
        }

        if ( 'image/gif' === $mime_type ) {
            if ( ! $this->make_image( $filename, 'imagegif', array( $image$filename ) ) ) {
                return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
            }
        } elseif ( 'image/png' === $mime_type ) {
            // Convert from full colors to index colors, like original PNG.             if ( function_exists( 'imageistruecolor' ) && ! imageistruecolor( $image ) ) {
                imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
            }

            if ( ! $this->make_image( $filename, 'imagepng', array( $image$filename ) ) ) {
                return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
            }
        } elseif ( 'image/jpeg' === $mime_type ) {
            if ( ! $this->make_image( $filename, 'imagejpeg', array( $image$filename$this->get_quality() ) ) ) {
                return new WP_Error( 'image_save_error', __( 'Image Editor Save Failed' ) );
            }
        } elseif ( 'image/webp' == $mime_type ) {
            if ( ! function_exists( 'imagewebp' ) || ! $this->make_image( $filename, 'imagewebp', array( $image$filename$this->get_quality() ) ) ) {
                
Home | Imprint | This part of the site doesn't use cookies.