繁体   English   中英

PHP上传类别问题,文件超过6Mb

[英]Php Upload Class issue with file over 6Mb

我正在制作一个相册,用户可以在其中上传自己的照片。 我希望用户能够将任何大小的图片发送到网站,如果超过5Mb,则使用php上传类将其处理为5Mb。

该文件的上载适用于小于php.ini文件中30Mb的配置的任何图片大小。 原始图片将上传到一个临时文件夹中进行处理。

我可以轻松处理图片以创建缩略图和主图片,但是当我要生成大文件(处理为5Mb供用户下载)时,它不起作用。

这是我用来处理图片的代码:

$handle = new upload("../".$path_picture_temp.$this->imgName);

    if ($handle->uploaded) {
      $handle->image_convert         = 'jpg';
      $handle->jpeg_size             = 5242880;
      $handle->process("../".$path_picture_full);
    }
    if ($handle->uploaded) {
      $handle->image_resize         = true;
      $handle->image_x              = 231;
      $handle->image_y              = 153;
      $handle->image_ratio_crop     = true;
      $handle->image_convert        = 'jpg';
      $handle->jpeg_quality         = 95;
      $handle->process("../".$path_picture_thumb);
    }
    if ($handle->uploaded) {
      $handle->image_resize         = true;
      $handle->image_x              = 1000;
      $handle->image_y              = 1000;
      $handle->image_ratio          = true;
      $handle->image_convert        = 'jpg';
      $handle->jpeg_quality         = 95;
      $handle->process("../".$path_picture_main);
    }

当我上传6Mb以下的图片时,即使速度很慢也可以使用,但是如果我上传6Mb以上的图片,则无法使用,甚至无法处理任何内容。

当我开始处理大图片的第一部分时,对于任何文件大小,一切都可以正常工作。 有谁知道为什么会这样?

如果使用GD和imagcreatefromjpeg()函数,则可能会解决您的问题: PHP GD imagecreatefromjpeg无法处理大尺寸图像?

暂无
暂无

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

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