【问题标题】:Orientation of photos in CSS formCSS形式的照片方向
【发布时间】:2014-01-03 15:06:22
【问题描述】:

我正在制作表格,从我的数据库中拍摄照片“准备打印”在 A4 纸上。 有些照片是按高度定向的,例如:800x600,有些是例如 600x800。我需要一些 php 脚本,它可以自动将水平照片旋转到垂直和垂直照片保持其方向。

【问题讨论】:

标签: php css forms orientation photo


【解决方案1】:

您可以将 imagerotate 与 php.. http://www.php.net/manual/fr/function.imagerotate.php

【讨论】:

    【解决方案2】:

    你需要这样的东西:

    $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忙,没时间测试。

    问候

    【讨论】:

    • 我收到了这个:注意:未定义的变量:第 70 行 /home/doprava/www/dano/foto.php 中的度数警告:file_put_contents():提供的资源不是 / 中的有效流资源new/index.php 在第 73 行
    • hmm 远 $degrees = 90;那它输出什么?
    猜你喜欢
    • 1970-01-01
    • 2012-08-12
    • 2012-11-11
    • 2012-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-18
    相关资源
    最近更新 更多