Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16882] iOS: Converting a blob into a valid image does not maintain dimensions

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-08-27T22:13:56.000+0000
Affected Version/sRelease 3.2.2
Fix Version/sRelease 3.4.0
ComponentsiOS
Labelsmodule_imageview, parity, qe-manualtest, qe-testadded, supportTeam
ReporterEduardo Gomez
AssigneeVishal Duggal
Created2014-04-25T21:35:47.000+0000
Updated2014-09-19T22:20:06.000+0000

Description

Issue description

Looking for a cross-platform way to create image thumbnail files asynchronously. Titanium is able to read an image file asynchronously into a buffer and then a blob. If we assign that blob to the image property of an ImageView, it displays as I expect. However, the blob is not recognised as an image by any of the Ti.Blob.image* methods. The blob has a mime type of "application/octet-stream" and a height and width of 0. Meanwhile Android is able to get height and width properly.

Steps to reproduce

Launch sample app. You can see that the fishImage ImageView loads its image directly from a file path in its "image" property.

earthImage is loaded in index.js asynchronously using a file stream. Once the file contents are read completely, they are assigned to the image property of $.earthImage.

Notice, the blob you get as a result of "earthBuffer.toBlob()" can't be used for any other image manipulation (e.g. creating thumbnails). It doesn't have a valid mimeType, height, or width on iOS.

E.G.
$.earthImage.image = earthBuffer.toBlob();
Ti.API.info( $.earthImage.image.height + ' . '+ $.earthImage.image.width + ' . '+ $.earthImage.image.mimeType);

Android

04-24 15:11:03.812: I/TiAPI(28395):  1600 . 2560 . application/octet-stream

iOS

[INFO] :   0 . 0 . application/octet-stream

Attachments

FileDateSize
ImageBufferTest_Appcelerator.zip2014-04-25T21:35:48.000+00008617039
TIMOB-16882.zip2014-04-28T21:22:14.000+00005952811

Comments

  1. Ingo Muschenetz 2014-05-20

    Marked for future release, so removing due date. Please re-add if this is incorrect.
  2. Vishal Duggal 2014-07-10

    Pull pending against master https://github.com/appcelerator/titanium_mobile/pull/5901
  3. Priya Agarwal 2014-08-19

    Reopening the issue as issue seems to appear incorrect on Android. Verified with environment: Appcelerator Studio:3.4.0.201408180158 Sdk:3.4.0.v20140815142514 alloy:1.5.0-dev titanium:3.4.0-dev titanium-code-processor:1.1.1 acs:1.0.16 npm:1.3.2 OS:Maverick(10.9.4) xcode: Xcode6Beta5 Device:iPhone5s(v8.0),Nexus7(v4.4.2) Getting Result as : On iOS:
       [ERROR] Done
       [INFO] 1600 . 2560 . application/octet-stream
       [INFO] 1600 . 2560 . application/octet-stream
       
    On Android:
       [ERROR] :  Done
       [INFO] :   0 . 0 . application/octet-stream
       [INFO] :   0 . 0 . application/octet-stream
       
    Now iOS shows the dimension but android does not shows the same.
  4. Sabil Rahim 2014-08-27

    This issue was for IOS and it still remain resolved. Will clone a bug for the android issue.
  5. Priya Agarwal 2014-08-28

    Verified with environment: Appcelerator Studio:3.4.0.201408270900 Sdk:3.4.0.v20140827165712 alloy:1.5.0-dev titanium:3.4.0-dev titanium-code-processor:1.1.1 acs:1.0.16 npm:1.3.2 OS:Maverick(10.9.4) xcode: Xcode6Beta6 Device:iPhone5s(v8.0) For iOS Working as expected. Not working for android. Already bug logged TIMOB-17567 Hence closing the issue.

JSON Source