Maximum blog is helpful information
for web design and worpdress development.
Explore all our post.
Maximum blog is helpful information
for web design and worpdress development.
Explore all our post.

Elementor custom image size and crop

How Crop Image in Elementor?

You may have problems if you want to get a cropped image in an element. To easily get the cropped image by size in the elementor, use the following code.

Use the default function by Elementor: \Elementor\Group_Control_Image_Size::get_attachment_image_src('id', 'thumbnail', $settings)

$settings = $this->get_settings_for_display();



<?php 
			$image_url = \Elementor\Group_Control_Image_Size::get_attachment_image_src( $settings['img']['id'], 'thumbnail', $settings );
			$image_html = '<img src="' . esc_attr($image_url) . '" alt="' . esc_attr( \Elementor\Control_Media::get_image_alt( $settings['img'] ) ) . '" />';
							
	echo $image_html;
							
?>
	
						
	

do not forget press apply:)

Leave a comment