Monday 15 September 2014

html - how to grab image from link and show it on website using curl and php -



html - how to grab image from link and show it on website using curl and php -

i want image here png image

to shown within html under header , grab using curl. shows text.

<html> <h1>summoner icon</h1> <?php ch = curl_init(); curl_setopt ($ch, curlopt_url, $url); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_binarytransfer, 1); $image = curl_exec($ch); curl_close($ch); echo $image; ?> </html>

to embed image in html, don't need download php. embed in html:

class="lang-html prettyprint-override"><img src="http://ddragon.leagueoflegends.com/cdn/4.18.1/img/profileicon/711.png" alt="" />

you should note, however, type of embedding remote images (called “hotlinking”) may undesired owner of remote site. please inquire them before hotlinking.

also note, when image removed day, won't displayed anymore. therefore, best thing download image , upload own server (assuming legally allowed so). alter src attribute point right url on own server.

php html html5 image curl

No comments:

Post a Comment