Page 5 of 5

How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Thu Jul 30, 2015 8:47 pm
by Joe Sharples

Hi Yurri,

Thanks for your help.
I had a look at the link but I'm still a little stuck and not sure where to start.

can you give me a few steps to implement this?

Thank you
Joe


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Mon Aug 03, 2015 4:22 pm
by Joe Sharples

I'm going to post this as a separate thread as it is a separate question


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Aug 05, 2015 2:01 am
by Yurii Orishchuk

Hi Joe,

Here is JS code how you can get image from first image, resize it and then put it source into another component:

precode

//Get img component. You should replace "mobileimage_1" with your img component name.
var img = Apperyio("mobileimage_152");

var width = img.width();
var height = img.height();

var newWidth = 30;
var newHeight = height / newWidth * width;

var canvas = jQuery('<canvas width="' + newWidth + '" height="' + newHeight + '"></canvas>');

var c = canvas[0];
var ctx = c&#46;getContext("2d");

ctx&#46;drawImage(img[0], 0, 0, newWidth, newHeight);

&#47;&#47;Get base64String&#46;
var base64String = c&#46;toDataURL();

&#47;&#47;Using base64String&#46;
console&#46;log(base64String);
&#47;&#47;alert(base64String);

&#47;&#47;Set this picture to other image component to be sure picture is ok&#46;
Apperyio("mobileimage_154")&#46;attr("src", base64String);

/code/pre

Regards.


How can I have the user upload their own photo and have that photo stored on the database so that each user can have his

Posted: Wed Aug 19, 2015 4:18 pm
by Joe Sharples

Thank you Yurii this really helped, sorry for my late response to this.