We recently rolled out Creative Commissary, our project management tool for image producers. It's a completely separate app from TalentSoup in every way. They do not share databases, and communicate via a JSON-based RESTful API. Clients build and manage projects in Commissary, and the talent details (name, contact info, etc.) are stored in TalentSoup.
In TalentSoup, talent have the option of selecting any of their photos as the main photo. This is the photo whose thumbnail will be shown in search results and project galleries. This main photo is the talent's first impression on the client, and therefore the talent's most important photo.
Originally, when doing a search return (Commissary sending search parameters to TalentSoup, TalentSoup returning a search result to Commissary), I was including the static URL for the main photo at the time of the search as the
main_photo value. This value would be stored in Commissary and would be referenced when rendering a gallery page for the client to look at. One thing I didn't take into account, however, was that talent might change their
main_photo anytime after the gallery for that particular project was built. When that happened, the image being displayed in the gallery wouldn't change, because the URL was being stored statically on the Commissary side.
This is a problem because sometimes talent change their
main_photo based on what type of project they're being considered for (we let them know when they're added to a gallery, and what type of job it is). For example, right now we're managing a job for a client who is going to be photographing people running. As a result, some talent changed their
main_photo to show them running or doing some sort of physical exercise. This should be reflected in the galleries, obviously!
Basically what I needed was a service like Gravatar. One URL I could pass around between TalentSoup and Commissary that would always render the given talent's
main_photo. I came up with a simple solution. I am not sure if this is the best way to accomplish this, but it works. Here's a controller action that lives on the TalentSoup side:
It takes the talent's
id as a parameter and will always display the
main_photo. Now I can do this on the Commissary side:
And I'll always get the
main_photo for a given talent even when they change it. We can make this more efficient by caching on the TalentSoup side, and invalidating when the talent changes their main photo.