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

components photo (HTML5 canvas)

Engaged ,
May 10, 2021 May 10, 2021

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.jpgexpand image

 

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 {}

	});
};

 

25e2a496c8204acd1e5c459d86d905e4expand image

 

773
Translate
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

what is it that you're trying to do?

 

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

Translate
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

@kglad  Yes, exactly 

Translate
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

@kglad 

giphy.gifexpand image

Translate
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

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);

 

 

 

 

Translate
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

@kglad 

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

Translate
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

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

Translate
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
LATEST
Translate
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