public function AFile::getImage in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7
1 call to AFile::getImage()
- FileCommited::resizeImage in vendor/
edsdk/ file-uploader-server-php/ src/ lib/ file/ FileCommited.php
File
- vendor/
edsdk/ file-uploader-server-php/ src/ lib/ file/ AFile.php, line 140
Class
Namespace
EdSDK\FileUploaderServer\lib\fileCode
public function getImage() {
$path = $this
->getFullPath();
$image = null;
switch (strtolower($this
->getExt())) {
case 'gif':
$image = @imagecreatefromgif($path);
break;
case 'jpeg':
case 'jpg':
$image = @imagecreatefromjpeg($path);
break;
case 'png':
$image = @imagecreatefrompng($path);
break;
case 'bmp':
$image = @imagecreatefromwbmp($path);
break;
}
// Somewhy it can not read ONLY SOME JPEG files, we've caught it on Windows + IIS + PHP
// Solution from here: https://github.com/libgd/libgd/issues/206
if (!$image) {
$image = imagecreatefromstring(file_get_contents($path));
}
// end of fix
if (!$image) {
throw new MessageException(Message::createMessage(Message::IMAGE_PROCESS_ERROR));
}
imagesavealpha($image, TRUE);
return $image;
}