TheFriendlyHacker's avatar

Can you hide overflow on an <img> tag?

I am allowing users to upload thumbnail images for posts they make. In order to comply with the site's layout, the images have to be about 450px x 225px.

Obviously, I wouldn't want to limit users to only being able to upload images with those exact dimensions. And I don't want to just resize the images to those dimensions, because it will distort them.

Is it possible to set an img tag to hide any overflow? That way, if someone uploads an image that is 600x300px, it will "crop" it?

0 likes
1 reply
tekmi's avatar

Hi @TheFriendlyHacker

I'm not sure, but maybe giving your customers an option to crop the image before it gets saved, is not that bad in the end.

It's not resizing, it's giving them the way to adhere to image dimensions you expect on your website.

I was using http://scottcheng.github.io/cropit/ library and it worked pretty well for me.

Best!

Please or to participate in this conversation.