Skip to content

Instantly share code, notes, and snippets.

@tristanlins
Created July 6, 2012 09:50
Show Gist options
  • Save tristanlins/3059292 to your computer and use it in GitHub Desktop.
Save tristanlins/3059292 to your computer and use it in GitHub Desktop.
interface Media
{
Media static get(String file);
bool isImage();
bool isPDF();
bool isVideo();
bool isAudio();
bool hasThumb();
Media getThumb(Size size);
bool isResizeable();
Media resize(Size size, CropMode cropMode);
Size getSize();
int getFilesize();
...
// usw.
}
<?php
$objImage = Media::get('tl_files/images/Wallpaper.jpg');
$objThumb = $objImage->getThump(new Size(100, 100));
// $objThumb -> Thumbnail von Wallpaper.jpg
?>
<?php
$objVideo = Media::get('tl_files/videos/imagevideo.mp4');
$objThumb = $objVideo->getThumb(new Size(100, 100), 90);
// $objThumb -> Thumbnail von imagevideo.mp4 bei Sekunde 90
?>
<?php
$objPDF = Media::get('tl_files/pdf/brochure.pdf');
$objThumb = $objPDF->getThumb(new Size(100, 100), 2);
// $objThumb -> Thumbnail von brochure.pdf Seite 2
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment