Skip to content

Commit 92648b3

Browse files
authored
Update FilesUploadAndImageResize.php
1 parent d9c33bc commit 92648b3

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/FilesUploadAndImageResize.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public function __construct(string $format, array $allowExtension, string $fileD
5252
public function compressImage(string $sourceURL, string $destinationURL, int $minImgWidth, array $waterMark = [], int $quality, string $newWidth): bool|string
5353
{
5454
try {
55+
//Check if GD extension is enable or not
56+
if (!extension_loaded('gd')) {
57+
return $this->param['gd_extension'][] = 'Check your php.ini file and enable or insatll GD extension'; //Extensions missing
58+
exit;
59+
}
5560
if (!empty($waterMark)) {
5661
$waterMark['font-size'] = (empty($waterMark['font-size'])) ? 25 : $waterMark['font-size'];
5762
$waterMark['font-family'] = (empty($waterMark['font-family'])) ? __DIR__ . "/fonts/Myriad-Pro-Regular.ttf" : $waterMark['font-family'];
@@ -166,12 +171,6 @@ public function createDir(string $fileDestination, int $filePermission): string
166171
public function uploadFiles(string $fileParamName, int $minImgWidth = 400, array $waterMark, string $reName = "", int $quality = 100, string $newWidth = "", array $thumbWidth = []): array|string
167172
{
168173
try {
169-
// if (!extension_loaded('gd')) {
170-
// if (!dl('gd.so')) {
171-
// $this->param['gd_extension'][] = 'Check your php.ini file and enable or insatll GD extension'; //Bad extensions move in this array
172-
// exit;
173-
// }
174-
// }
175174
if (!empty($_FILES[$fileParamName])) {
176175

177176
$srcPath = $this->createDir($this->fileDestination, $this->filePermission) . '/';

0 commit comments

Comments
 (0)