【发布时间】:2014-01-03 15:06:22
【问题描述】:
我正在制作表格,从我的数据库中拍摄照片“准备打印”在 A4 纸上。 有些照片是按高度定向的,例如:800x600,有些是例如 600x800。我需要一些 php 脚本,它可以自动将水平照片旋转到垂直和垂直照片保持其方向。
【问题讨论】:
标签: php css forms orientation photo
我正在制作表格,从我的数据库中拍摄照片“准备打印”在 A4 纸上。 有些照片是按高度定向的,例如:800x600,有些是例如 600x800。我需要一些 php 脚本,它可以自动将水平照片旋转到垂直和垂直照片保持其方向。
【问题讨论】:
标签: php css forms orientation photo
您可以将 imagerotate 与 php.. http://www.php.net/manual/fr/function.imagerotate.php
【讨论】:
你需要这样的东西:
$filename="image.jpg";
// get the width and height from the image
list($width, $height, $type, $attr) = getimagesize($filename);
//if image width is bigger then the height it will execute the following script
if ($width > height){
// Load the image
$source = imagecreatefromjpeg($filename);
// Rotate
$rotate = imagerotate($source, $degrees, 0);
//and save it on your server...
file_put_contents("myNEWimage.jpg",$rotate);
}
您可能会进行一些调整和测试。工作atm忙,没时间测试。
问候
【讨论】: