Successfully reported this slideshow.
Your SlideShare is downloading. ×

Serving Images with GridFS

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 11 Ad
Advertisement

More Related Content

Similar to Serving Images with GridFS (20)

Advertisement

More from Mark Smalley (19)

Recently uploaded (20)

Advertisement

Serving Images with GridFS

  1. 1. STORING AND SERVING IMAGES WITH GRIDFS Mr. Mongo Mark @m_smalley
  2. 2. z MEDIA STORAGE & SERVING ( without using a file-system )
  3. 3. z WHY 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 PHP CODE GETTING 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 Image header('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/

Editor's Notes

  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

×