I’ve been struggling the past couple weeks with a seemingly simple feature. The user submits a business name, we grab some data Factual’s places database, and then we import an image from the website of the business. Simple enough.
Two gems have helped implement this: metainspector to crawl the page and return an array of image URLs, and fastimage to determine the dimensions of a given image. To determine which image to import, we make an assumption: the largest image in the array of dimensions will be the best.
For the most part it’s worked out, but there are times when the largest image is not the best image. An crappy website tends to have crappy images, regardless of their size.
It’s been discouraging to see some of these images in an otherwise beautiful web application, so this feature hasn’t quite felt right. I set it aside for a few days, but returned to it earlier in the week to improve it. The results just haven’t been there.
Then I found an elegant solution: disregard the image altogether.
It might sound silly, but sometimes the fastest way to remove a blocker is removing the feature from which it originates. Is it really that important to show an image from the damn website? After considering what information matters to the user and spending some time in Photoshop, it became clear that, on balance, these images made the app worse.
I now have less code, fewer requests, two fewer gems, a faster app, and, it turns out, a better design. Problem solved.