My goal is to mask each individual image in a portfolio using svg.js
to generate the image mask. I am working with svg.js
and a cargo.collective theme.
I wrote some js to generate the <svg>
tag and wrap a set of images individually, this works fine however <img>
tags do not render inside of <svg></svg>
To get around this problem I am using svg.js to generate a seperate <image>
tag. This is where my problem lies - I can't seem to get transfer the source in <img>
to the new <image>
tag created in svg.js
My best efforts returned [object Object] in the <image>
href.
I would like to get the images to render inside the <svg>
tags so i can apply the mask to them irrespective of what image is actually in the container.
HTML
<svg class="thumb_image" id="drawing" xmlns="http://www.w3.org/2000/svg" version="1.1" width="100%" height="100%" xmlns:xlink="http://www.w3.org/1999/xlink">
<image id="SvgjsImage1005" width="0" height="0"></image>
<image class="imgclip" src="http://payload280.cargocollective.com/1/16/516926/7919591/prt_275x242_1403202556_2x.jpg" width="275" height="242" data-hi-res="http://payload280.cargocollective.com/1/16/516926/7919591/prt_275x242_1403202556_2x.jpg"></image>
<defs id="SvgjsDefs1000">
<polygon id="SvgjsPolygon1006" points="0,0 275,50 0,270" fill="#f2f0ce" stroke-width="0"></polygon>
</defs>
</svg>