Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2062] Mobile Web: ImageView doesn't work properly with images assigned as files

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-03-13T17:09:57.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterRoman Kamenetsky
AssigneeRitu Agrawal
Created2013-03-13T15:45:42.000+0000
Updated2016-03-08T07:41:01.000+0000

Description

Bug description: ImageView doesn't display an image if it is assigned as a Titanium.File. Assigning an image as path to the file works properly. Steps to reproduce: - 1. Create an ImageView and assign a Titanium.File to the "image" property - 2. Run application Expected behavior: application should run and show an image. Actual behavior: application runs but doesn't show an image. The HTML generated for the image has the actual binary image content in the "src" attribute of the "img" tag (base64 was probably intended). Code example: assuming that you have a proper image in resourseDirectory/images/
	var self = Ti.UI.createView();
	
	var imageView = Ti.UI.createImageView({
		image: Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, '/images/apple_logo.jpg'),
		width: 100,
		height: 100
	});
	
	self.add(imageView);

Comments

  1. Davide Cassenti 2013-03-13

    I cannot reproduce this issue. I tried the code you sent, placing an image in the Resources folder, and it is shown up correctly. I used SDK 3.1.0.v20130312161655
  2. Roman Kamenetsky 2013-03-28

    It seems that it doesn't work only on Chrome. Have you tried it on Chrome?
  3. Mostafizur Rahman 2013-12-12

    We tried to reproduce the issue with a sample case with Titanium 3.1.3. However, we were not able to reproduce the issue in Mobile Web. Please test the sample and let us know if the issue persists.

    Test Environment:

    OS: MAC OS X 10.8.5 Ti SDK: 3.1.3 GA, 3.2.0.x Ti CLI: 3.3.0 Google Chrome, Firefox

    Test Code

       var win = Ti.UI.createWindow({
       	backgroundColor : '#000',
       	title : 'Show Web Image',
       	navBarHidden : false
       });
       
       // create a imageView
       var imageView = Ti.UI.createImageView({
       	image : Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, "/images/MyPicture.jpg"),
       	width : 100,
       	height : 100
       });
       // add to parent View
       win.add(imageView);
       win.open(); 
       
       

    Step to reproduces

    Create a new project

    Paste this code in app.js file

    Add image in images directory inside resources directory

    Run this in mobile web

    Image will display

    Expected Result

    Image will display

JSON Source