After being combined to form a thin film, but the film will be shaped, how to have the object-fit:cover effect of css?

I have set the imagecreatetruecolor to be 300x300
, but I have set it to (400,300).
I forced it to be 200
, but the film produced by me will be flattened (because the original temperature is 300, I set it to 200, so it will be flattened)
how to achieve the object-fit:cover effect of css
and then add it to the cloth?

Update code
clipboard.png


Yes, you can do this with php's gd function library. The main functions used are creating canvas imagecreate class function, copying function imagecopy and imagecopyresampled, coloring function imagecolorallocate, keeping transparent imagecolortransparent

Menu