Resize Image In PHP

Resize image in wordpress

Are you looking for image Resize PHP function . I had implemented a simple PHP script to re-sizing image into different dimensions. i  noticed we need to show images in different size in our website that is too difficult to store same images with different different size.we write a function for how to play with image and we get a desired size of images.

Below is function that need to paste in your function.php

Name of function webtechsource_image_resize. This function needs four parameter

1. Image url
2. Width of image
3. Height of image
4.Single is always true

 

Important thing How we call this function. That is simply you can put below code where you want

$ImageUrl = wp_get_attachment_image_src($imageId, ‘large’);
$ImageSrc = webtechsource_image_resize($ImageUrl[0], 973, 274, true);
$ImageSrc is link of your desired image width 973 or height 274.

If you need  any more help write us or comment on blog surely we will help more. I hope above all solutions worked for you, share this post  and enjoy your day.

I, Dayanand Saini,the founder and chief editor of www.webtechsource.com,have been working as a software engineer from last 4+ years. It's my hobby to learn new things and implement on live environment.

Leave a Reply

Your email address will not be published. Required fields are marked *

+ 56 = 60

%d bloggers like this: