}
@Override
public void onSuccess() {
// resize file
Canvas upThumb = com.gloopics.g3viewer.client.canvas.Factory.getInstance().createCanvas();
upThumb.decode(m_Blob);
float imageWidth = (float)upThumb.getWidth();
float imageHeight = (float)upThumb.getHeight();
float widthRatio = imageWidth/((float)m_ResizeOptions.getMaxWidth());
float heightRatio = imageHeight/((float)m_ResizeOptions.getMaxHeight());
if (widthRatio > heightRatio){
if (widthRatio > 1) {
upThumb.resize(m_ResizeOptions.getMaxWidth(), (int)(imageHeight / widthRatio) );
m_UploadFile.uploadBlob(upThumb.encode());
return;
}
m_UploadFile.uploadBlob(m_Blob);
}
else
{
if (heightRatio > 1){
upThumb.resize((int)(imageWidth / heightRatio), m_ResizeOptions.getMaxHeight());
m_UploadFile.uploadBlob(upThumb.encode());
return;
}
m_UploadFile.uploadBlob(m_Blob);
}
}