I’m new to web development.
I have a webpage in PHP in which there is an image.
I want to post this photo on a blog with this script
<div id="x"></div>
<script>
var img = document.createElement("img");
img.src = "http://www.meteoarachova.com/stickersPWS/sticker.php";
var src = document.getElementById("x");
src.appendChild(img);
</script>
how can I resize the image and put a link for the blog visitor to return to the image page?
Resize the image using
el.style.width = 50%;
andimg.style.height = 50%;
this will resize the images width and height by 50%. You can also use pixels or other size increments in CSS usingel.style.width/height
.As for creating a link, if you want to use the image as a link, you could create an
a
tag and wrap it around the image controlling the size of image in that element. Then add thehref
attribute pointing to the page you wish to open when the user clicks the image.