Hello i have to set canvas image dynamically
Below is code for WordPress
$image= http://captoons2.se7enmarketing.com/wp-content/uploads/2014/06/eden-apple-180x138.jpg","http://captoons2.se7enmarketing.com/wp-content/uploads/2014/06/gravesite-180x138.png"
This is my main.js code
var data = {
"images": [ "images here"
],
"captions":[ ]};
In the above js code i want to pass $image data in “images” i have tryied wp_localize_script() bt it not working
I followed the code from the tutorial HTML5 Canvas Image Loader Tutorial and applied it to my theme as follows:
Enqueue and localize in
functions.php
:Add the
canvas
div tosingle.php
:Small adaptation from the original code in
my-kinetic.js
to pull the data from the localized object. Load the sources fromkinets.images
and iterate through the object numeric keys (instead of key names):