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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eaa1e4-1fad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eaa1e4-1fad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?