Serving Images with GridFS

5,175 views
4,940 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
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,175
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
49
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 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/

    ×