neo4j-examples / graphgist_portal

New GraphGist portal written in Rails and using GraphStarter
2 stars 2 forks source link

Need to thumbnail images #71

Open ryguyrg opened 8 years ago

ryguyrg commented 8 years ago

Currently images displaying on neo4j.com/graphgists/ are HUGE - many exceeding 1MB. We need to thumbnail the images.

cheerfulstoic commented 8 years ago

We could do this if we installed ImageMagick and wrote some custom code, though I think it would be probably cheaper in the long-run to use something like https://www.imgix.com/

@simpsonjulian didn't like adding another service, so I'll let him comment

simpsonjulian commented 8 years ago

Is there a suitable Heroku addon?

cheerfulstoic commented 8 years ago

It looks like Heroku has ImageMagick (version 6.7.7-10). So we should be able to build something to thumbnail the images. I worry about how much time is available and maintaining the solution. That's up to Ryan / Michael.

simpsonjulian commented 8 years ago

By "Heroku addon", I meant somthing like blitline.

cheerfulstoic commented 8 years ago

Ah, sure. But we still need to manage/store the images.

simpsonjulian commented 8 years ago

Ideally they'd all be on the same bucket as the other images, so I can make the decision to apply a CDN later. Also, any image url should be HTTPS://.

cheerfulstoic commented 8 years ago

Ok... alternatively... I could stop whining and realize that this is already a feature built into the paperclip gem which we are already using and which can use Heroku's built-in imagemagick installation...

Yeah, that would be good...

So I did that!

I set up some paperclip "styles" (medium is 300x300, thumbnail is 50x50) and rebuilt the images based on what's in the database (which should basically just add extra versions to what's already on S3).

When I load the /graph_gists page with shift-reload images accounted for 4.7MB out of the total 5.0 MB for the page. After my change they account for 879KB out of the total of 1.1 MB.

Does that work for y'all?

neo4j.com is showing the original images at the moment, but hopefully in 10 minutes when the cache expires that should start using the medium sized images too.