Convert Javascript data to image source - javascript

I have the following code:
function myFunction(title) {
var searc_url = 'http://www.omdbapi.com/?apikey=cc47980e&t='.concat(title)
$.getJSON(searc_url,
function(data, textStatus, jqXHR) {
console.log(data)
console.log(data["Title"])
console.log(data["Year"])
console.log(data["imdbRating"])
console.log(data["Poster"])
document.getElementById("title").innerHTML = data["Title"]
document.getElementById("year").innerHTML = data["Year"]
document.getElementById("rating").innerHTML = data["imdbRating"]
document.getElementById("myImg").src = data["Poster"]
}
)
}
I am trying to call an image from an API, where I call:
document.getElementById("myImg").src = data["Poster"]
(The API returns the website url of the image).
Then, when I try to link this as an image in my body like so:
<img id="myImg" src='data["Poster"]' alt="The Pulpit Rock">
The image never loads. I just get the alt text. I've tried doing this, and I've tried
<img src="myImg" alt="Movie Image">
but this behaves similarly.
I've tried to google this but I'm pretty new to Javascript, HTML and PHP as a whole so it's hard to sift through the technical jargon.
Do I need to be converting this to a variable in some way that I am not??
I am just having issues displaying it on the page- not sourcing it from the API.
The is not properly getting the variable I have set (id = myImg) that contains the url.
Thanks!
EDIT: Oops. Turns out this code does work- the issue was that my browser was blocking the scripts! Oops!
Thanks everyone.
I was trying to figure out why this wasn't cooperating.

maybe if you save the value in another variable, like charge it.
var imgValue = data.poster;
and lather set that value to img attribute;
document.getElementById("myImg").src = imgValue.toString();
I hope it can help you, Good Luck!

Ooops! Resolved!
My browser was blocking my scripts.
The method above does, indeed work. Sourcing with id="myImg"

Related

Javascript IF-Else not working as expected

HI guys trying to learn javascript and been on w3schools...came across a try me that flipped the image right away from smiley.gif to landscape.jpg...so I decided I was going to see if I learned anything by flipping it with a button instead worked great...but then I decided that on each click I was going to make it go back and forth from smiley.gif to landscape and back to smiley etc...
well thats when the frustration set in..I tried a million ways other then what I originally started with down in the code section...can someone explain to me why this doesnt work..I get no console errors...It still does the initial flip from smiley to landscape on first click but then never changes back to smiley on the second click. Thanks in Advance
<img id="image" src="smiley.gif" width="160" height="120"><br>
<button onclick= myFunc() >Click</button>;
<script>
function myFunc() {
if (document.getElementById("image").src == "smiley.gif") {
return document.getElementById("image").src = "landscape.jpg"
} else {
return document.getElementById("image").src = "smiley.gif"
}
};
</script>
<p>The original image was smiley.gif, but the script changed it to landscape.jpg</p>
The Issue
An element's src property returns the full path to the image, including protocol.
Although you've set the attribute to smiley.gif, if you were to console.log the property value, it's something like http://mywebsite.com/smiley.gif. Obviously, this is not equal to smiley.gif.
Using the src property:
console.log(document.getElementById("image").src);
<img id="image" src="test.jpg">
In the future make sure to take these basic debugging steps. If your condition isn't working right, the first step is to verify that the values you're comparing are what you expect them to be.
The Solution
Instead of using the src property, you want to retrieve the src attribute from the element instead. We can do this quite easily using Element.getAttribute().
Using the src attribute:
console.log(document.getElementById("image").getAttribute("src"));
<img id="image" src="test.jpg">
Your if condition should look like this:
if (document.getElementById("image").getAttribute("src") == "smiley.gif")
You should get the src of the img when the page loads so you can compare it as the src gives you the full qualified path of the img source.
<img id="image" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTY2gmwvcnkECDTu_N4qcfJs_5Nh1Usa8v3f-GaAzQcZxL70GpKCA" width="160" height="120"><br>
<button onclick= "myFunc()" >Click</button><br/>
<span id="result"></span>
<script>
var imgsrc = document.getElementById("image").src;
var result = document.getElementById("result");
function myFunc() {
if (document.getElementById("image").src == imgsrc) {
result.innerHTML = "Image source: "+"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSVQT4TyiJEFCRA3pmetp3fgZHpgQtzM1hKJMhvAJhOGchqHXQX";
return document.getElementById("image").src = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSVQT4TyiJEFCRA3pmetp3fgZHpgQtzM1hKJMhvAJhOGchqHXQX"
} else {
result.innerHTML = "Image source: "+"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTY2gmwvcnkECDTu_N4qcfJs_5Nh1Usa8v3f-GaAzQcZxL70GpKCA";
return document.getElementById("image").src = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTY2gmwvcnkECDTu_N4qcfJs_5Nh1Usa8v3f-GaAzQcZxL70GpKCA"
}
};
</script>
compare with == or ===
= sets the value, which is mostly true except you set a falsey value

alternative picture source for html webpage

i have a html webpage with some pics.
The pics are on the local pc.
The problem is there are two possible locations for the pic.
So i wonder if its possible to add an alternative picture path if the first path doesn´t exists.
I know it´s possible with php but it would be nice if there is another solution.
Thx
You can use following code
<img src="first_image_link" onerror="this.src='second_image_link';">
you could checkout the error event beeing thrown if the src points to 404
sth like :
image.onerror = function () {
image.src ="newsrc.jpg";
}
you could try s.th like that:
<img src="foo" altsrc="bar">
JS (jQuery):
$(function(){
$('img').on("error",function(){
$(this).attr("src",$(this).attr("altsrc"))
})
})

Decode an Image using JavaScript

I have a little generated JavaScript from a JSP page that looks like this:
var elem = document.getElementById("image");
elem.src = "Image?step="+step;
The code snippet above is called when the user clicks on a button, and step is a variable that is increased with every run of the function. Image is a Servlet that generates a PNG-encoded Image.
This works, but it is very slow because the Server must generate the Image when the Client wants it. I know I could pre-load the Image, but I thought of a better solution. Since I know how many steps are allowed, I thought of generating the Images when the page is requested, and embed them into the JavaScript, maybe Base64-encoded so that the Image can be viewed on all OS.
Is it possible to do this? If yes, how could I implement it? I don't want to use external JavaScript frameworks like jQuery, and I don't care about browsers that are not really common, it'll be enough if it works with Mozilla browsers and Google Chrome.
If you only want to embed the image source into a HTML page, you can do the following:
<img id="image" src="" width="100" height="100" alt="" />
<script type='text/javascript'>/* <![CDATA[ */
var img = '<?php echo base64_encode(file_get_contents('/path/file.png')); ?>'
document.getElementById('image').src = "data:image/png;base64," + image;
/* ]]> */</script>
This is supported by pretty much all browsers: http://caniuse.com/#feat=datauri … “Partial support” for IE means that it is limited to images and CSS, but images is what we do here.
Example: http://jsfiddle.net/m869e2ar/1/

Gallery of Images not displaying properly with document.getElementbyId()

So I'm working on a website for my job's store, a sort of gallery of our products. I've gotten the main web page, cut out the fat, put in the meat, and have tested it numerous times along the way. Now I am having some troubles with the JQuery not working properly. I have provided direct links to the JQuery code, a copy of the website itself, and the source code below..
The general layout of the JQuery(or Javascript, I'm not exactly sure which) is:
window.onload = function() {
function displayImage() {
var mainImg = document.getElementById('Main_IMG');
var caption = document.getElementById('caption');
mainImg.src = this.src;
caption.innerHTML = this.alt;
}
document.getElementById('Zero').onclick = displayImage;
document.getElementById('One').onclick = displayImage;
document.getElementById('Two').onclick = displayImage;
// Etc etc
}
Here is a segment of the website (with some extra fluff removed):
<h1 class="Wrapper Main ClearFix">Image Gallery</h1>
<div id="Main" class="Wrapper Main ClearFix">
<div id="container11">
<img id="Main_IMG" src="img/100___06/IMG_0001.JPG" alt=""><br>
<p id="caption"></p>
</div>
<div id="gallary">
<img id="One" src="img/100___06/IMG_0020.JPG" alt="Headboard Pricing">
<img id="Two" src="http://images.craigslist.org/00P0P_84oo9H7byag_600x450.jpg" alt="Needle Point Upholstered Chair Price: $40">
<!-- etc etc -->
The program is simple: When a user clicks on an image (say in a table for example), that image will display to the left of the gallery with the alt tag being the product and price and such.
The problem: At image number 16 I needed to give it a... different-from-normal tag
(tag I wanted to use: sixteen.
Tag I used: F_sixteen)
The program then worked fine for a few more 'numbers' up until the 36's and 40 where the program refuses to respond properly.
This is a link to the website as of writing this question:Here
This is a link to the actual jquery code: Here
And for those on mobile, the link to the source code is: Here
I apologize for the size of this question, as well as if this seems complicated. Thank you for viewing this, as I appreciate any help.
EDIT: I am not sure if the web page will work in Safari. If it doesn't, I'll see what I can do to change it.
OK, I hate to suggest using jQuery to someone who bravely is not. But use it. You can cut out the 40 calls to document.getElementById and reduce the risk of typos. Just include jquery in your page:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Then you can use the following code:
window.onload = function() {
function displayImage(img) {
var mainImg = document.getElementById('Main_IMG');
var caption = document.getElementById('caption');
mainImg.src = img.src;
caption.innerHTML = img.alt;
}
$("#gallary img").click(function(){
displayImage(this);
});
}
I've kept the required changes in the above code to a minimum. To 'jquerify' it further you could write this equivalent code instead:
$(function(){
var mainImg = $('#Main_IMG');
var caption = $('#caption');
$("#gallary img").click(function(){
mainImg.attr('src', this.src);
caption.html(this.alt);
});
});
Loading the site produces javascript error: "Uncaught TypeError: Object # has no method 'getElementByID'"
Examining the javascript, some of your calls are to getElementById, and some to getElementByID. Javascript is case-sensitive, you have a typo.

IMG SRC tags and JavaScript

Is it possible to call a JavaScript function from the IMG SRC tag to get an image url?
Like this:
<IMG SRC="GetImage()" />
<script language="javascript">
function GetImage() {return "imageName/imagePath.jpg"}
</script>
This is using .NET 2.0.
Nope. It's not possible, at least not in all browsers. You can do something like this instead:
<img src="blank.png" id="image" alt="just nothing">
<script type="text/javascript">
document.getElementById('image').src = "yourpicture.png";
</script>
Your favourite JavaScript framework will provide nicer ways :)
If you're in the mood for hacks, this works as well.
<img src='blah' onerror="this.src='url to image'">
Is it possible to call a JavaScript function from the IMG SRC tag to get an image url?
Do you mean doing something like the following?
<img src="javascript:GetImage()" />
Unfortunately, no - you can't do that. However, you can do the following hack:
function getImageUrl(img) {
var imageSrc = "imageName/imagePath.jpg";
if(img.src != imageSrc) { // don't get stuck in an endless loop
img.src = imageSrc;
}
}
Then, have the following html:
<img src="http://yourdomain.com/images/empty.gif" onload="getImageUrl(this)" />
The onload event will only fire if you have an actual image set to the src attribute - if you don't set that attribute or set it to an empty string or something similar, you will get no love. Set it to a single pixel transparent gif or something similar.
Anyway, this hack works, but depending on what you are really trying to accomplish, this may not be the best solution. I don't know why you would want to do this, but maybe you have a good reason (that you would like to share with us!).
You cannot do it inline the image #src, but you should be able to call it from an inline script block immediately following your image:
<img src="" id="myImage"/>
<script type="text/javascript">
document.getElementById("myImage").src = GetImage();
</script>
you could dynamically feed the image by calling an aspx page in the SRC.
Ex;
<img src="provideImage.aspx?someparameter=x" />
On the page side, you`ll need to put the image in the response and change the content type for an image.
The only "problem" is that your images won't be indexed a you better put some cache on that provider page or you'll ravage the server.
Are you looking for this.src ?`
<img src='images/test.jpg' onmouseover="alert(this.src);">
Since you're using .NET, you could add the runat="server" attribute and set the src in your codebehind.
You might be able to do it on the server side. Alternately you could attach an onload event to swap the image src out. I guess the question then becomes, why would you have to use Javascript in the first pace?
I've had to do something like this before, and IIRC the trick winds up being that you can't change an src attribute of an image that's part of the DOM tree. So your best bet is to write your HTML skeleton without the image and 1)create an onLoad function that generates a new img element with document.createElement, 2) set the src attribute with setAttribute(), and 3) attach it to your DOM tree.
OnLoad event of image called again and again do some thing like this
how about this?
var imgsBlocks = new Array( '/1.png', '/2.png', '/3.png');
function getImageUrl(elemid) {
var ind = document.getElementById(elemid).selectedIndex;
document.getElementById("get_img").src=imgsBlocks[ind];
}
it's not work?
<img src="'+imgsBlocks[2]+'" id="get_img"/>
You may try this way also
const myImage = new Image(200, 200);
myImage.src = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBEPEQ8PDxEPEQ8PEQ8PDw8RDxEPDw8PGBQZGRkUGBgcIS4lHB4rHxgYJzsmKzMxNzc1GiRIRTszPzA0QzEBDAwMEA8QGRISHjEhISE2MTQ0NDQxMTE0MTExMTQ0NDQ0NDExMTE0NDE0MTExMTQ0NDQ0MTQxMTExPzExNDQxMf/AABEIAM4A9QMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAAAQcCBQYEA//EAEgQAAIBAgIDCwgIBAMJAAAAAAABAgMEERIFBiEHExYxNFR0krKz0jIzNVFhcnOTIkFCYnGRodEVgZTBI1LwFBckJVOio7HC/8QAGQEBAAMBAQAAAAAAAAAAAAAAAAEDBAUC/8QAKxEBAAIABAUDAwUBAAAAAAAAAAECAxExUQQTFDKBEiEzQXGxImGh0fAj/9oADAMBAAIRAxEAPwC5gAAAAAgwqVFFOUmlFJtybwSS42yvNOa+1HKULKMVCLw36azOXtjHiS9rx/ke8PDtiTlV4veK6rGBTj1v0jziXy6fhIet2kecy6lPwmjo8TeFfPquQFNcLtI85n1KfhIet+kecy6lPwkdHibwnn1XMCmeF+kecz6lL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nBN5uLZxn3ejabVNN1G6Kyxlvk82VxScXLHFppLHHjaPjHQdulJZZtOnKjtqTbVJxcci27Ek3h6sWB6aOkKU4xmppKdSVKKlF05OpFyTjlkk1LGMtj9R4rvTcaU60JRj/hOEVmqZZScsn0sGsFBZ1jLHZg9hs7e3jSUlFYKU51Htb+nOTk3+bZ8Kuj6cpynJ1HKUJwX+JPCEZJKWVY/RbwW1AeCGnc6ouNGco11UUMtSDc5wU24x+px+j5WK8qP1Y4IafTbUqUkqc4wryzxcaeaq6cXF/aWZPF7MMGeuroejPDzkUoqMIwqzhGGEXBSST2SUW1ij5LQdvhFSUpQglDJKTcJwi8YwlHilFPFpP1sD4z0+lGdSNGbhTqqm5OUY4xcacoyS+8qiwTw4ni0Zz0xLJXnGEGrdzzRlWlCpki5LM45HxuOxbcTPg/arOoUlTjUljUhSbpQqfRjHLKMcE44QWz8fWz7vRlPFylnlKUqbbnOU/Jk5Rjt+ypPHAD1UZSlGLlHLJxi5RxTcZNbY4rjwPsAAAAAAAAAAAAH/2Q==';
document.body.appendChild(myImage);
No. The Img's SRC attribute is not an event, therefore the inline JS will never fire.
OnLoad event of image called again and again do some thing like this

Categories

Resources