Skip to content

Commit b83424c

Browse files
author
Vladimir Demidov
committed
allow gif and bmp to resize
1 parent f1868b9 commit b83424c

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

Gruntfile.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module.exports = function (grunt) {
131131
mxmlc: {
132132
core: {
133133
options: {
134-
rawConfig: '-target-player=10.1 -static-link-runtime-shared-libraries=true -compiler.debug=true' +
134+
rawConfig: '-target-player=10.1 -static-link-runtime-shared-libraries=true -compiler.debug=false' +
135135
' -library-path+=flash/core/lib/blooddy_crypto.swc -library-path+=flash/core/lib/EnginesLibrary.swc'
136136
},
137137
files: {
@@ -140,7 +140,7 @@ module.exports = function (grunt) {
140140
},
141141
image: {
142142
options: {
143-
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=true' +
143+
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=false' +
144144
' -library-path+=flash/image/lib/blooddy_crypto.swc'
145145
},
146146
files: {
@@ -149,7 +149,7 @@ module.exports = function (grunt) {
149149
},
150150
camera: {
151151
options: {
152-
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=true'
152+
rawConfig: '-static-link-runtime-shared-libraries=true -compiler.debug=false'
153153
},
154154
files: {
155155
'dist/<%= pkg.exportName %>.flash.camera.swf': ['flash/camera/src/FileAPI_flash_camera.as']

dist/FileAPI.flash.swf

-32.6 KB
Binary file not shown.

flash/core/src/ru/mail/commands/ResizeFileCommand.as

+4-9
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ package ru.mail.commands
2222
*
2323
* file must be loaded before transforming.
2424
*
25-
* Only JPG or PNG images.
26-
* Performing transform on gif or bmp will result in returning the original image data.
25+
* JPG and PNG will keep their extensions after transform.
26+
* GIF and BMP will be encoded as PNG, so uploaded filename will be .png
2727
*
2828
* The possible solution is to transform them but save as PNG, but we also have to change the uploaded file extension to png.
2929
*
@@ -47,18 +47,16 @@ package ru.mail.commands
4747
{
4848
if( !file.imageData ) {
4949
complete(false, null, new ErrorVO("ResizeImageCommand - cannot resize file because it has not been succesfully loaded") );
50+
return;
5051
}
5152

5253
if (!needResize()) {
5354
LoggerJS.log('ResizeImageCommand no need to resize');
5455
complete(true, file.fileData);
56+
return;
5557
}
5658

5759
var fileType:String = file.fileType;
58-
if (fileType == "gif" || fileType == "bmp") {
59-
// TODO: scale but save jpg
60-
complete(true, file.fileData)
61-
}
6260

6361
checkTransform();
6462

@@ -143,15 +141,12 @@ package ru.mail.commands
143141

144142
if (imageTransform.multiPassResize && maxScale < 0.5) {
145143

146-
trace ("multi-step ");
147-
148144
var curWidth:Number = currentImageMap.width;
149145
var curHeight:Number = currentImageMap.height;
150146
var mapToScale:BitmapData;
151147
// multi-step
152148
while(maxScale < 0.5)
153149
{
154-
trace ("step ", maxScale);
155150
// series if x2 scalings
156151

157152
// temp bitmapdata

0 commit comments

Comments
 (0)