diff --git a/classes/hoamimewrapper.php b/classes/hoamimewrapper.php deleted file mode 100644 index f90082a..0000000 --- a/classes/hoamimewrapper.php +++ /dev/null @@ -1,43 +0,0 @@ -=5.5.0" - }, - "require-dev": { - "hoa/stream": "~1.0", - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Consistency\\": "." - }, - "files": [ - "Prelude.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Consistency library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "autoloader", - "callable", - "consistency", - "entity", - "flex", - "keyword", - "library" - ], - "time": "2016-03-03 09:37:24" - }, - { - "name": "hoa/event", - "version": "1.16.03.15", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Event.git", - "reference": "b1577069d63d6efc559406f3bc31813ac33e76b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Event/zipball/b1577069d63d6efc559406f3bc31813ac33e76b8", - "reference": "b1577069d63d6efc559406f3bc31813ac33e76b8", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/exception": "~1.0" - }, - "require-dev": { - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Event\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Event library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "event", - "library", - "listener", - "observer" - ], - "time": "2016-03-15 14:49:59" - }, - { - "name": "hoa/exception", - "version": "1.16.01.11", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Exception.git", - "reference": "fa4a9648aef2c8ca8f4cd543429b24dc8feaa366" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Exception/zipball/fa4a9648aef2c8ca8f4cd543429b24dc8feaa366", - "reference": "fa4a9648aef2c8ca8f4cd543429b24dc8feaa366", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/event": "~1.0" - }, - "require-dev": { - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Exception\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Exception library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "exception", - "library" - ], - "time": "2016-01-11 08:38:17" - }, - { - "name": "hoa/file", - "version": "1.16.01.15", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/File.git", - "reference": "bc04ddb476bfeee03c2be585fc37a98d2887277b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/File/zipball/bc04ddb476bfeee03c2be585fc37a98d2887277b", - "reference": "bc04ddb476bfeee03c2be585fc37a98d2887277b", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/event": "~1.0", - "hoa/exception": "~1.0", - "hoa/iterator": "~2.0", - "hoa/stream": "~1.0" - }, - "require-dev": { - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\File\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\File library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "Socket", - "directory", - "file", - "finder", - "library", - "link", - "temporary" - ], - "time": "2016-01-14 20:55:07" - }, - { - "name": "hoa/iterator", - "version": "2.16.03.15", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Iterator.git", - "reference": "60bdefab8db17717871a11101dedec60572f95b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Iterator/zipball/60bdefab8db17717871a11101dedec60572f95b8", - "reference": "60bdefab8db17717871a11101dedec60572f95b8", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/exception": "~1.0" - }, - "require-dev": { - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Iterator\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Iterator library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "iterator", - "library" - ], - "time": "2016-03-15 14:51:54" - }, - { - "name": "hoa/mime", - "version": "3.16.01.15", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Mime.git", - "reference": "c26f02fc531a0e66eb15ccab1d73e76fdb0fa5f6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Mime/zipball/c26f02fc531a0e66eb15ccab1d73e76fdb0fa5f6", - "reference": "c26f02fc531a0e66eb15ccab1d73e76fdb0fa5f6", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/exception": "~1.0", - "hoa/protocol": "~1.0", - "hoa/stream": "~1.0", - "hoa/zformat": "~1.0" - }, - "require-dev": { - "hoa/file": "~1.0", - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Mime\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Mime library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "library", - "mime", - "type" - ], - "time": "2016-01-14 21:32:00" - }, - { - "name": "hoa/protocol", - "version": "1.16.07.07", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Protocol.git", - "reference": "28fc998fac9c7364338ec98177fef353e76e4efb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Protocol/zipball/28fc998fac9c7364338ec98177fef353e76e4efb", - "reference": "28fc998fac9c7364338ec98177fef353e76e4efb", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/exception": "~1.0" - }, - "require-dev": { - "hoa/test": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Protocol\\": "." - }, - "files": [ - "Wrapper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Protocol library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "library", - "protocol", - "resource", - "stream", - "wrapper" - ], - "time": "2016-07-07 21:03:43" - }, - { - "name": "hoa/stream", - "version": "1.16.09.06", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Stream.git", - "reference": "f8dec80b6ff3b7898a5604d304ecb73f53d04901" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Stream/zipball/f8dec80b6ff3b7898a5604d304ecb73f53d04901", - "reference": "f8dec80b6ff3b7898a5604d304ecb73f53d04901", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/event": "~1.0", - "hoa/exception": "~1.0", - "hoa/protocol": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Stream\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Stream library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "Context", - "bucket", - "composite", - "filter", - "in", - "library", - "out", - "protocol", - "stream", - "wrapper" - ], - "time": "2016-09-06 11:14:23" - }, - { - "name": "hoa/zformat", - "version": "1.16.03.15", - "source": { - "type": "git", - "url": "https://github.com/hoaproject/Zformat.git", - "reference": "d261637aa6f4485d697ebcb898a379f7a34b4e34" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/hoaproject/Zformat/zipball/d261637aa6f4485d697ebcb898a379f7a34b4e34", - "reference": "d261637aa6f4485d697ebcb898a379f7a34b4e34", - "shasum": "" - }, - "require": { - "hoa/consistency": "~1.0", - "hoa/exception": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Hoa\\Zformat\\": "." - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Ivan Enderlin", - "email": "ivan.enderlin@hoa-project.net" - }, - { - "name": "Hoa community", - "homepage": "http://hoa-project.net/" - } - ], - "description": "The Hoa\\Zformat library.", - "homepage": "http://hoa-project.net/", - "keywords": [ - "library", - "parameter", - "zformat" - ], - "time": "2016-03-15 14:55:30" - }, { "name": "mattyg/array_column_maintain_keys", "version": "1.0.1", diff --git a/helpers/checkimagetype.php b/helpers/checkimagetype.php index d947c62..51d4698 100644 --- a/helpers/checkimagetype.php +++ b/helpers/checkimagetype.php @@ -3,16 +3,13 @@ /** @var string $filename */ $allowedImageTypes = loadPicFile("helpers/imagetypes.php"); -//$type = new Hoa\Mime\Mime(new Hoa\File\Read($filename)); $originalExtension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); -//$originalExtension = strtolower($type->getExtension()); if (!in_array($originalExtension, $allowedImageTypes)) { sendError(400); } + $mimeType = MrMime::extensionToMimeType($originalExtension); -//$mimeType = $type->getMime(); $actualMimeType = MrMime::resolveMimeType($filename); -//$actualMimeType = HoaMimeWrapper::picGetMimeTypeFromFilename($filename); if ($actualMimeType !== $mimeType) { Logger::warning("error", "Invalid image found.", array("filename" => $filename, "expectedMimeType" => $mimeType, "actualMimeType" => $actualMimeType)); sendError(500); @@ -26,5 +23,4 @@ $normalisedExtension = $originalExtension; break; } -//return array($normalisedExtension, $originalExtension, $mimeType); return array($normalisedExtension, $mimeType); diff --git a/main.php b/main.php index 78b5cd5..e078bfb 100644 --- a/main.php +++ b/main.php @@ -20,7 +20,6 @@ function loadPicFile($includePicFilename, array $extractVars = array(), $getCont loadPicFile("vendor/autoload.php"); loadPicFile("main/logging.php"); loadPicFile("classes/accesscontrol.php"); -//loadPicFile("classes/hoamimewrapper.php"); loadPicFile("classes/mrmime.php"); loadPicFile("main/auth.php"); diff --git a/modes/loadimage.php b/modes/loadimage.php index a067650..6ff1d97 100644 --- a/modes/loadimage.php +++ b/modes/loadimage.php @@ -2,7 +2,6 @@ $fullFilename = loadPicFile("helpers/checkfilepath.php"); -//list($normalisedExtension, $actualExtension, $mimeType) = loadPicFile("helpers/checkimagetype.php", array("filename" => $fullFilename)); list($normalisedExtension, $mimeType) = loadPicFile("helpers/checkimagetype.php", array("filename" => $fullFilename)); $imageSizes = json_decode(loadPicFile("conf/app.json"), true)["image_sizes"]; @@ -21,9 +20,7 @@ $image = Image::open($fullFilename); $image->setCacheSystem($cache); $image->cropResize($imageSize["width"], $imageSize["height"]); -//if ($normalisedExtension === "jpeg") { - $image->fixOrientation(); -//} +$image->fixOrientation(); $imageData = $image->cacheData($normalisedExtension); header("Content-type: $mimeType");