library file
File information package
sebastiansulinski/file
File information package
- Tuesday, March 13, 2018
- by sebastiansulinski
- Repository
- 2 Watchers
- 3 Stars
- 3,817 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 6 Versions
- 7 % Grown
File information package for different file types.
Currently contains only Image file type implementation., (*1)
Usage
require_once "vendor/autoload.php";
use SSD\File\File;
use SSD\File\Type\Image;
$image = new Image(new File('/path/to/the/file.jpg'));
// File specific info
echo $image->path(); // /path/to/the/file.jpg
echo $image->name(); // file.jpg
echo $image->nameWithoutExtension(); // file
echo $image->extension(); // jpg
echo $image->extension(true); // .jpg
echo $image->mimeType(); // image/jpeg
// Size specific info
echo $image->sizeInBytes(); // 49275
echo $image->sizeInBytesPostfix(); // 49275B
echo $image->sizeInKiloBytes(); // 48.12
echo $image->sizeInKiloBytesPostfix(); // 48.12KB
echo $image->sizeInMegaBytes(); // 0.05
echo $image->sizeInMegaBytesPostfix(); // 0.05MB
echo $image->sizeInMegaBytesPostfix(3, ' '); // 0.047 MB
// Image specific info
echo $image->width(); // 600
echo $image->height(); // 450
echo $image->type(); // 1
echo $image->attributes(); // width="600" height="450"
echo $image->isLandscape(); // true / false
echo $image->isPortrait(); // true / false
echo $image->isOfType(IMG_JPG, IMG_PNG); // true / false
// Methods returning all of the above
// as array
$image->toArray();
// as json
$image->toJson();
// as json
$image->toString();
// as json using __toString()
echo $image;
dev-master
9999999-dev
File information package
Sources
Download
MIT
The Requires
The Development Requires
by
Sebastian Sulinski
v2.0.1
2.0.1.0
File information package
Sources
Download
MIT
The Requires
The Development Requires
by
Sebastian Sulinski
v2.0.0
2.0.0.0
File information package
Sources
Download
MIT
The Requires
The Development Requires
by
Sebastian Sulinski
1.0.2
1.0.2.0
File information package
Sources
Download
MIT
by
Sebastian Sulinski
1.0.1
1.0.1.0
File information package
Sources
Download
MIT
by
Sebastian Sulinski
1.0
1.0.0.0
File information package
Sources
Download
MIT
by
Sebastian Sulinski