Uploadifive不能使用php 7.X

时间:2018-06-07 03:15:38

标签: php uploadify uploadifive

我一直在我的网站上使用uploadifive,使用PHP 5.X一直运行良好,但当我将其切换到PHP 7.(0-2)时,它停止工作。我一直得到"未知错误"。

我不确定在更改PHP版本时是否需要打开任何扩展程序,或者我的代码是否有问题?

这是上传者:http://www.uploadify.com/

这是它运行的php脚本:

if (!empty($_FILES)) {

    $tmpName        = $_FILES['Filedata']['tmp_name'];
    $newName        = $_FILES['Filedata']['name'];

    $newPath        = $_SERVER['DOCUMENT_ROOT'] .'/images/gallery/original/'.$newName;
    $disPath        = $_SERVER['DOCUMENT_ROOT'] .'/images/gallery/display/'.$newName;
    $thbPath        = $_SERVER['DOCUMENT_ROOT'] .'/images/gallery/tn/'.$newName;
    $wmImg          = $_SERVER['DOCUMENT_ROOT'] .'/administrator/components/com_gallery/assets/logo.png';

    $setSize        = 800;
    $thbSize        = 630;
    $jpeg_quality   = 100;

    copy($tmpName,$newPath);
    list($width, $height, $type, $attr) = getimagesize($newPath);

    # create display image with watermark
    if ($width > $height) {
        $newW = $setSize;
        $newH = round( $height * ( $setSize / $width ) );
    } else {
        $newW = round( $width * ( $setSize / $height ) );
        $newH = $setSize;
    };
    $img_r = imagecreatefromjpeg($newPath) or notfound();
    $dst_r = imagecreatetruecolor( $newW, $newH );
    imagecopyresampled($dst_r,$img_r,0,0,0,0,$newW,$newH,$width,$height);
    if (function_exists("imageconvolution")) {
        $matrix = array(array( -1, -1, -1 ),array( -1, 32, -1 ),array( -1, -1, -1 ));
        $divisor = 24;
        $offset = 0;
        imageconvolution($dst_r, $matrix, $divisor, $offset);
    };
    $mark = imagecreatefrompng($wmImg);
    imagealphablending($mark, true);
    imagesavealpha($mark, true);
    list($mwidth, $mheight) = getimagesize($wmImg);
    imagecopy( $dst_r, $mark, ($newW-$mwidth)-5, ($newH-$mheight)-5, 0, 0, $mwidth, $mheight );                 
    header("Content-type: image/jpeg");
    imagejpeg($dst_r,$disPath,$jpeg_quality);
    imagedestroy($dst_r);
    imagedestroy($mark);

    # create thumbnail
    if ($width > $height) {
        $newW = round( $width * ( $thbSize / $height ) );
        $newH = $thbSize;
        $newX = 0-($newW-$thbSize)/2;
        $newY = 0;
    } else {
        $newW = $thbSize;
        $newH = round( $height * ( $thbSize / $width ) );
        $newX = 0;
        $newY = 0-($newH-$thbSize)/2;
    };
    $img_r = imagecreatefromjpeg($newPath) or notfound();
    $dst_r = imagecreatetruecolor( $thbSize, $thbSize );
    imagecopyresampled($dst_r, $img_r, $newX, $newY, 0, 0, $newW, $newH, $width, $height);
    if (isset($sharpen)) {
        if (function_exists("imageconvolution")) {
            $matrix = array(array( -1, -1, -1 ),array( -1, 32, -1 ),array( -1, -1, -1 ));
            $divisor = 24;
            $offset = 0;
            imageconvolution($dst_r, $matrix, $divisor, $offset);
        };
    };
    header("Content-type: image/jpeg");
    imagejpeg($dst_r,$thbPath,$jpeg_quality);
    imagedestroy($dst_r);

    # delete original
    unlink($newPath);

    echo "1";

}

我相信PHP 7的所有功能都可以,我不知道为什么在更改PHP版本后它没有工作。

0 个答案:

没有答案