Hosting images externally

Hi all.

I am wondering if there is an easy way to configure middleman to build image links prefixed with a non / path. Say I have an S3 bucket or something, I’d like

![img](filename.jpg)

to end up as

http://pathto.com/s3/bucket/bunchanumbers/filename.jpg

not

http://mymiddlemansite.com/http://pathto.com/s3/bucket/bunchanumbers/filename.jpg

which is what I get if I set images_dir to my external url.

I feel like there is either an easy way to do this that I’m missing or it’s not supported. Haven’t had much luck in the docs. Thank you!

I’m pretty new to this myself, but maybe this can help. Try adding a helper in the config.rb:

helpers do
    def s3img filename
        image_tag 'http://pathto.com/s3/bucket/bunchanumbers/' + filename
    end
end

I use HAML for my markup, so if I were using this, I’d use:
= s3img 'filename.jpg'

and it generates:
<img src="http://path.to/s3/buck/bunchanumbers/test.jpg" />

Hopefully this is a good start for you.

Cheers.