So I know that the general logic of my code works because I used Enum.fetch! @images, 0
and it did correctly render the image in my instagram.html.eex template.
images =
["https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11379745_1585313748409462_103808145_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11379061_1580569178876434_1167877115_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11356353_720047521439521_517049214_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11380197_942331749159310_1992474397_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11352262_665047260292000_1054860417_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11386498_990626080949891_1423590947_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11352272_1569209376665091_1658680765_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11280373_1592635194340044_1060704364_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11325094_474317772719156_1896736744_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11333436_1600407830243623_350543047_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11352120_465119366990489_1639159111_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11326467_1434492820189965_1446808827_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11240423_725189817589936_503777762_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11258491_1423288671324276_1463333487_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11236108_830332670386695_1290447161_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11259294_1428168007489568_508368786_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11253258_1427746127534220_829136796_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11208327_839915566043721_1300848010_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/10607924_694990410622797_534859355_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/11192912_1613498252201707_300090299_n.jpg"]`
In my template I have this line:
<% IO.inspect @images %>
which correctly prints what is expected:
`["https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11379745_1585313748409462_103808145_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11379061_1580569178876434_1167877115_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11356353_720047521439521_517049214_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11380197_942331749159310_1992474397_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11352262_665047260292000_1054860417_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11386498_990626080949891_1423590947_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11352272_1569209376665091_1658680765_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11280373_1592635194340044_1060704364_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11325094_474317772719156_1896736744_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11333436_1600407830243623_350543047_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11352120_465119366990489_1639159111_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11326467_1434492820189965_1446808827_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xfa1/t51.2885-15/s150x150/e15/11240423_725189817589936_503777762_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11258491_1423288671324276_1463333487_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11236108_830332670386695_1290447161_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11259294_1428168007489568_508368786_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xaf1/t51.2885-15/s150x150/e15/11253258_1427746127534220_829136796_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xap1/t51.2885-15/s150x150/e15/11208327_839915566043721_1300848010_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/10607924_694990410622797_534859355_n.jpg",
"https://scontent.cdninstagram.com/hphotos-xpa1/t51.2885-15/s150x150/e15/11192912_1613498252201707_300090299_n.jpg"]
This line correctly shows the first image in the images list of URLs:
<img src="<%= Enum.fetch!(@images, 0) %>">
However, this line:
<%= @images |> Enum.map fn(image) -> IO.puts "<img src='" <> image <> "' height='150px'>" end %>
Gives me an error saying that only lists of lists or binaries work.
Does anything look suspicious in my map? I want to map across the list and essentially print <img src="<%= image_url %>">
for each.