Babban matsalar da ke da alaƙa da ƙara hotuna daga tushe mai nisa shine cewa yana iya haifar da jinkirin lokacin loda shafi. Wannan saboda dole ne mai lilo ya yi buƙatu daban don kowane hoto, wanda zai iya ƙarawa da sauri idan akwai hotuna da yawa a shafin. Bugu da ƙari, idan tushen nesa yana ƙasa ko yana da jinkirin haɗi, wannan na iya ƙara jinkirta lokutan loda shafi. A ƙarshe, akwai kuma ƙara haɗarin rashin tsaro tun lokacin da ake ciro hotunan daga wani waje.
<img src="https://example.com/image.jpg" alt="Example Image">
1. Wannan layin code shine alamar hoton HTML, wanda ake amfani dashi don nuna hoto akan shafin yanar gizon.
2. Siffar "src" tana ƙayyade URL na hoton da za a nuna, a wannan yanayin shine "https://example.com/image.jpg".
3. Halin "alt" yana ba da madadin rubutu don hoton, a wannan yanayin shine "Hoton Misali".
img src sifa
Ana amfani da sifa img src a cikin HTML don tantance tushen hoto. Ana amfani da shi a cikin ciki tag don ayyana tushen hoto. Ya kamata darajar wannan sifa ta zama ingantaccen URL mai nuni zuwa fayil ɗin hoto. Ana buƙatar wannan sifa don duk hotuna akan shafin yanar gizon, kuma yana ba mai bincike damar ganowa da nuna hoton.
Ta yaya zan ƙara hoto na waje a HTML
Ƙara hoto na waje a HTML abu ne mai sauƙi. Duk abin da kuke buƙatar yi shine amfani da yi alama kuma saka tushen hoton ta amfani da sifa src. Maƙasudin ƙara hoto na waje a HTML yayi kama da haka:
Inda "image_url" shine hanyar haɗi zuwa fayil ɗin hoton, kuma "madadin rubutu" shine bayanin abin da ke cikin hoton (don dalilai masu isa).
Misali, idan kuna son ƙara hoto na waje daga gidan yanar gizonku mai suna my-image.jpg, lambar ku zata yi kama da haka: