How to get properties or method? - javascript

When we replaced the image path on the canvas,there is some method can use,such as
fabric.util.loadImage or fabric.Image.fromURL(function(){})....
I want to change src of the image on the group when I click the button,I use setSrc(imagePath) method,but it can't use.
After that,I guess there could be the image loaded problem.
I replaced the method fabric.Image.fromURL(function(){}) as the above and delete the browser cache ,no reply.
Finally,I modify the image to the Circle,and set the fill after.
I use the setFill() to change the color,it can't,neither.
Howerer,I use the set("fill","red"),it ran smoothly.
I was confused,did those method outdated?
Or I made the mistake somewhere?
It's the demo from this.
I saw the question on
https://github.com/kangax/fabric.js/issues/1762
And I want to know where can get properties,because I saw the tutorial page of the official website,
It shows the opacity,width,height.....etc.
http://fabricjs.com/docs/fabric.Image.html
Are the properties show there?
And how can I modify the image path to achieve the result we want?
Thanks.

Related

Image Source broken in JS, using MongoDb

I am using MongoDB to upload and store images in Javascript.
However, when the image gets uploaded it appears in the inspect element as "/image.png". When you remove the slash in inspect element the image I uploaded appears.
How can I fix this?
You might need to specify a little bit more information in order to get the best possible answer.
My first question would be: "How consistent is the backslash?"
If it's in every single DB entry, then prior to pushing it to the page, I'd strip the backslash using something like the below:
var retImgSrc = retImgSrc.substr(1);
If the DB entry isn't consistent, or you find the consistency isn't to your liking, the logic may need to change.
Hope that helps

determine final destination/url returned by a asp(?) by script

So, I'm sure this will get down voted and I'll be banned from the site because I'm a total newb that asks elementary questions/wrong questions/vague questions that irritate the community. But...I'm not sure where else to turn, this seems to be one of the best communities.
I use a live chat service. And they have this cut/paste bit of markup that you drop into your page and it'll display a jpeg indicating whether or not the chat service is open.
https://rci.ehosts.net/netagent/client/invites/chatimage.aspx?style=style0&questid=44D115D4-5242-476F-AE56-6AEECE8E9343&portid=28586436-7974-4E4B-BBDE-73E63BC3EAED&imagelanguage=en-us&customopenimage=https%3A//rci.ehosts.net/netagent/custfiles/en_chat_open.gif&customcloseimage=https%3A//rci.ehosts.net/netagent/custfiles/en_chat_closed.gif
If you drop that into a browser, it doesn't seem like anything happens. But if you set that as the src attribute of a image tag in a html page, it displays the appropriate image (chat online/chat unavailable).
My question is...can I determine the outcome of that script without dropping it into the page? Via either javascript or php? What'd like to do is make a script of my own that will determine which image is returned and do things other than just displaying the chat online/chat unavailable images.
Thanks!
EDIT: oh, the above url will redirect to the correct image if you change all the & to just &
I ended up following the redirect to see which image it takes me to. It was the only way I could think of. Ended up basically copying example #2, except that I returned the headers location, from the following link:
php manual

Get Full Path of current photo in Fotorama With data-auto set to true

I am using the fotorama version 4.5.2 plugin for a photo gallery on a personal website. I want to be able to have a button on the page that will allow me to edit certain information about the current photo displayed that is stored in a database. For this, I need some data about the current photo that is displayed, preferably the full path of the picture, but something like id would probably work. My question is: How do I get this data about the current picture displayed? I have seen some stuff where you can set data-auto to false and manually load fotorama. I would prefer to leave the auto function set to true as I am happy with how everything is working, and it seems like too much of a hassle to set everything manually. If the only way to get this data is by setting data-auto to false, then how do I set everything up manually? I've found the API documentation on fotorama's site (http://fotorama.io/customize/api/) to be confusing, and my attempts to get it to work manually have failed. Any help would be greatly appreciated.
I finally found a solution. You can call this javascript function from a button and it will give you the current photo's full path.
function getPicName () {
var name = $(".fotorama__active").find("img.fotorama__img").attr('src');
alert(name);
}

Jquery image gallery issue in expression engine

I have a slight problem with a javascript plugin i have integrated into expression engine (EE). I'm not sure whether its a CSS/HTML problem or something being overwritten in EE. I using the plug jqzoom, which i've managed to integrate fine on my static site However on my EE site click here the secondary image is not displaying (none) and is over lapping the primary. Initial set up of this plugin mean't to work like the following click here - you click on the thumbnail the image changes etc... does anyone know what's causing this problem?
in your first link I saw two images are already in a div with a class clearfix. But in the second one there is only one. I think somehow you messed up with the images in the first one. Try to look in the code where you entered the image source in the website you mentioned in first link

Chrome extension planting an image in the current document

I'm trying to write a Chrome extension that as a part of what it's doing needs to add an image to the currently displayed html. I guess I need to use document.createElement and then insert it somewhere, but I'm not sure about two things:
The image comes as part of the extension, i.e. there's no direct link to it anywhere, so simply adding an img tag won't work. Unless I'm missing something.
Not Chrome-related at all: what is the best way to add the img tag to a specific location if the html elements do NOT have any id's? I can find the place I want to add the img to using regexps, and can rewrite the whole html if needed, but maybe there's a more subtle way I'm missing.
You can get image url from your extension folder by running:
var imgUrl = chrome.extension.getURL("image.png");
(it would look like this: chrome-extension://<extension_id>/image.png)
If you're using manifest-version: 2 you'll need to whitelist any resource in your extension that you inject into other documents. See this question for more info.
As to your second question - you need to provide more details. Does it have class? Do you know inside what tag is it (li, div)? You probably would be better off using jQuery for this - it has lots of pretty advanced selectors. I don't know what search criteria are you trying to use exactly so I can't suggest a concrete solution.

Categories