<
Neerav Mehta
Founder & CEO
Crop: Cropping will remove portions of an image to make it the specified dimensions.
Desaturate: Desaturation will convert the image into a grayscale image.
Resize: Resizing will make images an exact set of dimensions. This may cause images to be stretched or shrunk disproportionately.
Rotate: Rotating an image may cause the dimensions of an image to increase to fit the diagonal.
Scale: Scaling will maintain the aspect-ratio of the original image. If only a single dimension is specified, the other dimension will be calculated.
Scale and Crop: Scale and crop will maintain the aspect-ratio of the original image, then crop the larger dimension. This is most useful for creating perfectly square thumbnails without stretching the ima
Once you are done with creating an Image style, you need to assign it to an image.
Image styles can be assigned in "Content Types Display" or "Views Field Display".
<content_type>
" -> Manage Display.Sometimes, we may need to display the styled image manually in our template file. We can use image_style_url($style_name, $path) function in such cases. This function returns the absolute URL where a style image can be downloaded, suitable for use in an <img>
tag. Requesting the URL will cause the image to be created. Here is an example:
// Original image uri.
$path = 'private://myimagefolder/imgfilename.jpg';
// Machine-readable name of the style.
$style = 'thumbnail';
// URL of the image style.
// Use this within your template file by assigning it to $vars['style_url'].
$style_url = image_style_url($style, $path);
Neerav Mehta
Neerav Mehta is the Founder & CEO of Red Crackle. With sterling qualities, Neerav’s technological acumen is firing a generation of progressive companies on the digital path. With an undergraduate degree in Electrical Engineering from India's most prestigious institution IIT Bombay and having spent seven years developing and contributing to the launch of AMD's innovative line of computer products, Neerav founded Red Crackle where he is lauded for his dynamic and innovative genius.
Let’s get you started!