Open GuySartorelli opened 4 months ago
4.*, 5.*
4.*
5.*
If you create a new file, and the file is an image, and you call $file->getIsImage(), it returns false if you created it using the File class.
$file->getIsImage()
false
File
Execute the below code, where $someFileLocation is the path to a file on your filesystem.
$someFileLocation
Regardless of what type of file that is, whether it's an image or not, false will be dumped out.
use SilverStripe\Assets\File; $file = File::create(); $file->setFromLocalFile($someFileLocation); $file->write(); // Publish the file $file->publishFile(); var_dump($file->getIsImage());
Check $this->appCategory(), e.g:
$this->appCategory()
public function getIsImage() { return in_array($this->appCategory(), ['image', 'image/supported']); }
That won't capture images that developers put in custom app categories - but I think that's an edge case we can live with.
No response
silverstripe/installer
Module version(s) affected
4.*
,5.*
Description
If you create a new file, and the file is an image, and you call
$file->getIsImage()
, it returnsfalse
if you created it using theFile
class.How to reproduce
Execute the below code, where
$someFileLocation
is the path to a file on your filesystem.Regardless of what type of file that is, whether it's an image or not,
false
will be dumped out.Possible Solution
Check
$this->appCategory()
, e.g:That won't capture images that developers put in custom app categories - but I think that's an edge case we can live with.
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)