-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
…ed file uploads
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4916,3 +4916,27 @@ function get_absolute_path($path) | |
} | ||
return implode(DIRECTORY_SEPARATOR, $absolutes); | ||
} | ||
|
||
/** | ||
* A function to validate images | ||
* | ||
* @param mixed $path | ||
* @return array | ||
*/ | ||
function validateImage($path) | ||
{ | ||
$result =[]; | ||
$checkImage = getimagesize($path); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dominikvitt
Author
Contributor
|
||
$result['debug'] = $checkImage; | ||
$result['uploadresult'] = ''; | ||
$checkSvg = mime_content_type($path); | ||
|
||
if (!($checkImage !== false || $checkSvg === 'image/svg+xml')) { | ||
$result['uploadresult'] = gT("This file is not a supported image - please only upload JPG,PNG,GIF or SVG type images."); | ||
$result['check'] = false; | ||
} else { | ||
$result['check'] = true; | ||
} | ||
|
||
return $result; | ||
} |
Like it :) (but why in common_helper) . Don't need
@getimagesize($path)
if debug is set ?