Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Serving Images with GridFS

5,802 views

Published on

The shortest presentation of my life - and an incredibly easy sell with a quick over-view of serving images with GridFS

Published in: Technology, Design
  • Be the first to comment

Serving Images with GridFS

  1. 1. STORING AND SERVING IMAGES WITHGRIDFS Mr. Mongo Mark @m_smalley
  2. 2. zMEDIA STORAGE & SERVING ( without using a file-system )
  3. 3. zWHY DO FILESYSTEMS SUCK ...? ( at serving media on the web )
  4. 4. POOR AT SCALING( with tedious back-ups and I/O bottlenecks )
  5. 5. POOR METADATA( lacking built-in meta storage and data queries )
  6. 6. STRICT CONVENTIONS ( naming and directory limits cause poor reliability )
  7. 7. GRIDFS ALSO USES REPLICA-SETS ( all media backed-up and load-balanced in chunks )
  8. 8. GRIDFS ALSO USES REPLICA-SETS ( all media backed-up and load-balanced in chunks )
  9. 9. EXAMPLE PHPCODEGETTING IMAGES OUT
  10. 10. www.your-domain.com/images/tron.jpg ( assuming .htaccess is redirecting within folder ) // Get Filename$slug = $_SERVER[‘REQUEST_URI’];// Define Database$db = $m->$options[db_name];// Get GridFS$grid = $db->getGridFS();// Get Image$image = $grid->findOne( array("name" => $slug));// Display Imageheader(Content-type: .$image->file[type]);echo $image->getBytes();
  11. 11. STALK ME ON TWITTER IF YOU LIKE@m_smalley Twitter Hashtag #klmug KL MUG on Twitter @klmug KL MUG on Facebook https://www.facebook.com/groups/klmug/

×