Elementor Code Reference
  • Developers
  • Code Reference
  • Docs
  • Blog
  • Account
  • Developers
  • Code Reference
  • Docs
  • Blog
  • Account

BFI_Image_Editor_Imagick_1_3

BFI_Image_Editor_Imagick_1_3()


Methods

  • colorize — Tints the image a different color
  • colorize — Tints the image a different color
  • colorize — Tints the image a different color
  • grayscale — Makes the image grayscale
  • grayscale — Makes the image grayscale
  • grayscale — Makes the image grayscale
  • negate — Negates the image
  • negate — Negates the image
  • negate — Negates the image
  • opacity — Changes the opacity of the image

Source

includes/libraries/bfi-thumb/bfi-thumb.php

	class BFI_Image_Editor_Imagick_1_3 extends WP_Image_Editor_Imagick {

		/** Changes the opacity of the image
		 *
		 * @supports 3.5.1
		 * @access   public
		 *
		 * @param float $opacity (0.0-1.0)
		 *
		 * @return boolean|WP_Error
		 */
		public function opacity( $opacity ) {
			$opacity /= 100;

			try {
				// From: http://stackoverflow.com/questions/3538851/php-imagick-setimageopacity-destroys-transparency-and-does-nothing
				// preserves transparency
				//$this->image->setImageOpacity($opacity);
				return $this->image->evaluateImage( Imagick::EVALUATE_MULTIPLY, $opacity, Imagick::CHANNEL_ALPHA );
			} catch ( Exception $e ) {
				return new WP_Error( 'image_opacity_error', $e->getMessage() );
			}
		}

		/** Tints the image a different color
		 *
		 * @supports 3.5.1
		 * @access   public
		 *
		 * @param string hex color e.g. #ff00ff
		 *
		 * @return boolean|WP_Error
		 */
		public function colorize( $hexColor ) {
			try {
				return $this->image->colorizeImage( $hexColor, 1.0 );
			} catch ( Exception $e ) {
				return new WP_Error( 'image_colorize_error', $e->getMessage() );
			}
		}

		/** Makes the image grayscale
		 *
		 * @supports 3.5.1
		 * @access   public
		 *
		 * @return boolean|WP_Error
		 */
		public function grayscale() {
			try {
				return $this->image->modulateImage( 100, 0, 100 );
			} catch ( Exception $e ) {
				return new WP_Error( 'image_grayscale_error', $e->getMessage() );
			}
		}

		/** Negates the image
		 *
		 * @supports 3.5.1
		 * @access   public
		 *
		 * @return boolean|WP_Error
		 */
		public function negate() {
			try {
				return $this->image->negateImage( false );
			} catch ( Exception $e ) {
				return new WP_Error( 'image_negate_error', $e->getMessage() );
			}
		}
	}
Elementor Code Reference
  • Code Reference
  • Elementor Hooks
    • PHP Hooks
    • JS Hooks
  • Elementor Classes
  • Elementor Methods
  • Elementor Functions
Developer Resources

Visit the official Developer Resources to learn how to extend Elementor.

Get Involved

Visit Elementor GitHub repository to contribute code or suggest new ideas.

  • Contact
  • About Us
  • Terms of Service
  • Privacy Policy
  • Template Library
  • Features
  • Theme Builder
  • Get Pro
Theme by Pojo.me
//Made in Elementor Page Builder
Enter your email and be the first to learn about new updates and features.
No thanks, I just want to download Elementor