title: Flask-SQLAlchemy: Photo column type
body: <p>In a web application I'm coding with Flask/SQLAlchemy, several of my models needs a "Photo" column type, which would handle storing the original image somewhere on the filesystem, and creating differents thumbnails size of the image. Ideally, I-d want something like:</p>
  
  <pre><code>class MyModel(Base):
      id        = Column(Integer, primary_key=True)
      photo     = Column(Photo(root="/path/to/photos/", formats={
          "big"      : "800x600",
          "small"    : "400x300",
          "thumbnail": "100x75"
      }))
  </code></pre>
  
  <p>and then, I could access URI/URL of file like this:  model.photo.big  etc...</p>
  
  <p>So, my question is: how to add setters/getters on the model.photo object so that I can access URIS/URLS with the mentionned syntax ? 
  By the way, if someone has a good tutorial/resource (other than the official doc) on user defined types with SQLAlchemy, I would be grateful if he could share it.</p>
  
  <p>Thx. </p>