Possible Duplicate:
Pass PHP variable to Javascript code
My question is how to pass php variables in a javascript method call which is in a php echo command. I am doing so, to make the image size dynamic.
My code below:
$imagedata = getimagesize("artwork/x.jpg");
echo '<td align="center"><img thumb="' . $big . $newFile . '" src="' . $images . $file . '" onclick="showImg(this, "'$imagedata[0]'", "'$imagedata[1])'");"></td>';
I understand why this results into an error and know how to pass php variables in a javascript method call but the code needs to be in a php echo which makes it a bit more complicated.