Mange / roadie-rails

Making HTML emails comfortable for the Rails rockstars
MIT License
367 stars 66 forks source link

Image_tag not working #9

Closed bcackerman closed 10 years ago

bcackerman commented 10 years ago

Everything works great except forimage_tag's in our emails. We have S3/Cloudfront setup with our image assets. The image src that is trying to be rendered is the local path to the image, not the Cloudfront link to the file like it would normally in our views.

Not sure if this is a bug or I haven't set something up correctly...

Mange commented 10 years ago

Have you set up Rail's asset_host setting in the environment you are rendering the email in? Rails should use the asset host when outputting the image tags.

We have bug #10 for problems with having the stylesheet inlined with an asset_host set, so I think that you might have to sacrifice something in your setup to have this work until that is fixed. Den 2 jul 2014 23:05 skrev "Bruce Ackerman" notifications@github.com:

Everything works great except forimage_tag's in our emails. We have S3/Cloudfront setup with our image assets. The image src that is trying to be rendered is the local path to the image, not the Cloudfront link to the file like it would normally in our views.

Not sure if this is a bug or I haven't set something up correctly...

— Reply to this email directly or view it on GitHub https://github.com/Mange/roadie-rails/issues/9.

bcackerman commented 10 years ago

Yes we have asset_host set. Would using just the roadie gem not the roadie-rails gem get image_tags working?

Mange commented 10 years ago

The thing is that roadie-rails doesn't touch image_path or image_tag at all. It only looks for rendered <img> with src that is not absolute (without a protocol part, IIRC). The easiest fix for you is to use the normal Rails helpers for images (image_tag, etc.).

Rails already does a lot of the URL rewriting features that Roadie provides. It should be enough for most people, I hope.