Skip to content

fixed height width of uploading image validation issue #33

@jitchavan

Description

@jitchavan

i am trying to add fixed height width image validation in image crud class but not succeded in it. tried below but not worked. image not uploaded but database entry done.

class ImageUploadHandler
{

private function has_error($uploaded_file, $file, $error) {

if ($uploaded_file && is_uploaded_file($uploaded_file)) {
$file_size = filesize($uploaded_file);

list($width, $height, $type, $attr) = getimagesize($uploaded_file);

if($width != 600 || $height != 800){

return 'maxFileSize';

}

    } else {
        $file_size = $_SERVER['CONTENT_LENGTH'];
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions