• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

components photo (HTML5 canvas)

Engaged ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

Hello everyone .. How are you?
I hope that you will be healthy and well-being and away from us Corona.

Please experts to help me .

 

Choose any image from the device ?

 

https://drive.google.com/drive/folders/1oFAxc49AuXqkGmPd-b4poiY4eu9ERQLa?usp=sharing

 

 

2021-05-10_13-06-22.jpg

 

var root = this;
var putFile;

root.stop();

root.INS_PHO.addEventListener("click", function (e) {

	root.PHO_1,

	function (container) {
		if (bitmapA)
		container.removeChild(bitmapA);
		bitmapA = new createjs.Bitmap(e.target.result);
		setTimeout(function () {
		container.addChild(bitmapA);
		}, 0);
	};
});

root.uploadImage = function (container, loadCallback) {

	INS_PHO.addEventListener("change", function (e) {
		if (e.currentTarget.files && e.currentTarget.files[0]) {
			var reader = new FileReader();
			reader.onload = function (e) {
				loadCallback(container);
			}
			reader.readAsDataURL(e.currentTarget.files[0]);
		} else {}

	});
};

 

25e2a496c8204acd1e5c459d86d905e4

 

Views

604

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

what is it that you're trying to do?

 

have the user select a local bitmap and then add that to the stage?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 10, 2021 May 10, 2021

Copy link to clipboard

Copied

@kglad  Yes, exactly 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

@kglad 

giphy.gif

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

there are security issues with doing that.  i did not know until i tried testing with this:

 

var fileSelector = document.createElement('input');
fileSelector.setAttribute('type', 'file');
fileSelector.setAttribute('onchange', 'displayPic()');

function f(e) {
fileSelector.click();
displayPic = function(){
displayPicture(fileSelector.value);
}
}

function displayPicture(imgPath) {
var image = new Image();
image.onload = onLoadF;
image.src=imgPath;
}

function onLoadF(e) {
var img = new createjs.Bitmap(e.target)

stage.addChild(img);
stage.update();

}

this.b.addEventListener("click",f);

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

@kglad 

Many thanks for trying to help me
I will try to solve it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

i don't think you can solve unless you use server-side code to handle the file upload.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 14, 2021 May 14, 2021

Copy link to clipboard

Copied

LATEST

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines