How to fetch the image from its URL and store it in a variable
As im having a URL of a image, i need to fetch that image and then store it in variable and display the image in the variable using the rails image tag, so how to approach this..
Thanks in advance
the method i tryed
require 'open-uri'
imagevar = open(url).read
img_tag(imgvar)
which resulted in following error
ActionView::Template::Error: string contains null byte
so what will the correct solution to approach this
To assign the URL to a variable in your
.erb, do the following.To render the image from the URL you can use
image_tag