PHPackages                             motters/image-safe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. motters/image-safe

ActiveLibrary

motters/image-safe
==================

Ensure a file is a valid image with a set of specifications.

0211PHP

Since Jun 25Pushed 9y agoCompare

[ Source](https://github.com/motters/image-safe)[ Packagist](https://packagist.org/packages/motters/image-safe)[ RSS](/packages/motters-image-safe/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Image Safe
----------

[](#image-safe)

This is used when you want to verify file uploads that are restricted to images only!

Basic verification provided by main stream frameworks is not sufficient and is insecure. Which is the reason for myself providing this package to the community.

### Use

[](#use)

```
public function uploadImageSafe()
{
	//Start image safe validation
	$v = new Motters\ImageSafe\ImageSafe();

	//Set the rules for image safe
	$validationRules = [
		//Types of mimes that are allowed
		'Mimes', // Optional settings ['allowed'=>['image/jpeg; charset=binary', 'image/jpg; charset=binary']]

		//Make sure file name is aplha numerical (Files should always be renamed anway!)
		'FileName', // Optional settings ['allowed'=>['-','_'], 'maximumCharacters'=>'100', 'minimumCharacters'=>'1']

		//Minimum and maxium size of file image (Minimum file size will help stop denial of service attacks )
		'FileSize', // Optional settings ['maximum'=>'2097152', 'minimum'=>'10240']

		//Make sure the image has some valid and set dumensions
		'DimensionSize', // Optional settings ['height'=>'1024', 'width'=>'768']

		//Searches for elements in the images mimes that could potential be arbatry code, this is very beta!
		'Characters', // ['unbanCharacters'=>['
