-1

I know there are lot of questions asked on this topic and have many grate answers. But non of those didn't worked for me. I my e-commerce website product images are 1025X1400. I need to resize any image to 1025X1400 when uploading a product image. If the selected image dimensions are less than 1025X1400 i need to add background color, without loosing aspect ratio. Like below

This is the sample image

I followed this question, and it worked, but it stretch the image. Question

How can i do this in PHP. Thank you

Edit I don't need to check the dimensions. I need to save uploaded images, after resizing(1025X1400).

2 Answers2

0

you can try to check the image size with javascript/jquery and add background color with an if statement to it. You dont need PHP for this.

SC92
  • 161
  • 13
0

PHP library to resize, scale and crop images. https://github.com/eventviva/php-image-resize