2021年3月14日星期日

Apache2.2 -> Apache2.4: The image extension cannot be obtained

The application that was running on Apache2.2/CentOS6.7 has been moved to Apache2.4/CentOS Stream environment.
When I checked the operation of image saving, I could not get the image, and when I checked it with the developer tools, the following error occurred in Network->Response.
Looking at the error, I couldn't get the extension, but it worked in Apache 2.2, so it's weird.
Is there anything to consider?

Error

Warning: getimagesize(home/www/Symfony/src/../../../../public/image_url_ori.): failed to open stream: No such file or directory  

ImageService

    public function saveImage(Image $image)      {          //Set extension          $ext = $image->getImageExtension();          if (!$ext && $image->getFileUpload()) {              $ext = $image->getFileUpload()->guessExtension();              $image->setImageExtension($ext);          }            $suffix = "_ori";          $image->setFileName(date('YmdHis') . '_' . mt_rand() . $suffix . '.' . $ext);        }  

Image.php

    public function setFileName($fileName)      {          $this->fileName = $fileName;            return $this;      }        public function getFileName()      {          return $this->fileName;      }        public function setImageTypeByFilePath($path)      {          $info = getimagesize($path);            if (isset($info[2])) {              $this->imageType = $info[2];          }            return $this;      }        public function postUpload()      {          $path = $shopYearDir . '/' . $this->fileName;      }        /**       * Set imageExtension       *       * @param string $attachedFileExtension       * @return Image       */      public function setImageExtension($ext)      {          $this->imageExtension = $ext;            return $this;      }        public function getImageExtension()      {          return $this->imageExtension;      }  
https://stackoverflow.com/questions/66598238/apache2-2-apache2-4-the-image-extension-cannot-be-obtained March 12, 2021 at 06:32PM

没有评论:

发表评论