简体   繁体   English

照片尺寸和用户相册的转换?

[英]Photo dimensions & conversions of user albums?

是否有任何php库可用于将照片重新缩放或重新调整为我们为高度/宽度/大小设置的限制,如果用户将照片上传为gif png或bmp然后将其转换为jpeg?

Are there any php libraries for this to re-scale or re-size photos down to whatever limit we set for height/width/size and also if users upload photos in gif png, or bmp then convert them to jpeg? 是否有任何php库可用于将照片重新缩放或重新调整为我们为高度/宽度/大小设置的限制,如果用户将照片上传为gif png或bmp然后将其转换为jpeg?

GD and ImageMagick GDImageMagick

(I'm ignoring the rest of your questions as they aren't programming related. I suggest you edit and remove those sections.) (我忽略了您的其余问题,因为它们与编程无关。建议您编辑并删除这些部分。)

What aspect ratio and file sizes to use are largely subjective, but there are a few guidelines you may want to follow. 使用哪种宽高比和文件大小在很大程度上是主观的,但是您可能需要遵循一些准则。

For aspect ratio the best thing to do (photographically at least) is to keep the same aspect as the original. 对于长宽比,最好的做法(至少在摄影方面)是保持与原始图片相同的长宽比。 I'd avoid stretching the photo in any way. 我会避免以任何方式拉伸照片。 If you have to, maybe crop it to fit a certain aspect ratio. 如果需要,可以将其裁切以适合特定的宽高比。

For file size, it really depends on what you want to do. 对于文件大小,这实际上取决于您要执行的操作。 Make them larger if you really want to retain a lot of quality and resolution. 如果您确实想保留很多质量和分辨率,请将它们放大。

There are many libraries available for image editing in PHP. 有许多库可用于PHP中的图像编辑。 I typically use GD. 我通常使用GD。 http://ca3.php.net/manual/en/refs.utilspec.image.php http://ca3.php.net/manual/zh/refs.utilspec.image.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM