Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12885] image property of Image View or backgroundImage property of View, does not handle URL redirect and does not load remote images.

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2018-08-30T02:33:56.000+0000
Affected Version/sRelease 3.0.0, Release 3.0.1, Release 3.0.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterAshish Nigam
AssigneeUnknown
Created2013-02-27T05:13:26.000+0000
Updated2018-08-30T02:33:56.000+0000

Description

image property of Image View or backgroundImage property of View, does not handle URL redirect and does not load remote images. Test Case, create a new allow project and then change the code to. **Sample Code** =>index.tss file code
".container": {
    backgroundColor:"white"
},
"#icon": {
    top:10,
    left:10,
    width: Ti.UI.SIZE,
    height: Ti.UI.SIZE,
    color: "#000",
    borderColor:"red",
    borderWidth:2
}
=>index.js file code
var imageUrl = " https://www.poweruprewards.com/SiteResources/i/catalog/lg/PaddysSnuggieL.jpg";
    $.icon.image = imageUrl;


$.index.open();

setTimeout(function(){
    $.icon.image = "/PaddysSnuggieL.jpg";
},10000);
=>index.xml file code
<Alloy>
    <Window class="container">
        <ImageView id="icon"></ImageView>
    </Window>
</Alloy>
1: Run sample as it is. Test Result: failed Reason: Image does not load and the error for max retry reached. 2: Run sample with this URL, URL = http://www.mapsofindia.com/maps/india/india-large-color-map.jpg Test Result: Passed Reason: Image Shows up properly. 3: Run sample with Both URL and using one URL with timeout method Test Result: Passed for URL = http://www.mapsofindia.com/maps/india/india-large-color-map.jpg and failed for second. Reason: Image Shows up properly. 4: Run sample with the image (PaddysSnuggieL.jpg and india-large-color-map.jpg) in URL saved locally in assets folder. TestResult: Passed for both the images. Reason: both images shows up properly.

Comments

  1. Reinoud 2013-03-05

    I have a similar issue on Android and 3.0.0/3.0.2. Might be related. Loading images from the web works, but when the image url is a dynamic source (.php) it won't show (Android issue only). First encountered using Alloy, but can reproduce the issue using Ti Classic single window app:
       //FirstView Component Constructor
       function FirstView() {
       	//create object instance, a parasitic subclass of Observable
       	var self = Ti.UI.createView();
       	
       	var image = Ti.UI.createImageView({
       		width:Ti.UI.SIZE,
       		height:Ti.UI.SIZE,
       		image:"http://api.coldtrick.com/mod/profile/icondirect.php?lastcache=1357651348&joindate=1357651236&guid=41&size=medium",
       		//image:"http://api.coldtrick.com/_graphics/icons/user/defaultmedium.gif",
       	});
       	self.add(image);
       	
       	return self;
       }
       
       module.exports = FirstView;
       
    The .gif will show (when uncommented), but the image from icondirect.php not. The content type of the response is "image/jpeg".
  2. Lev 2014-09-03

    This bug impacts Facebook now: profile images, retrieved with http://graph.facebook.com/fb_id/picture are redirected. The only workaround is to separately request direct profile picture urls, which is so inconvenient.
  3. Ingo Muschenetz 2014-09-03

    Re-assigning to triage.
  4. Ramesh RAMAMURTHY 2015-01-30

    may we have a status update on this issue please.
  5. Fokke Zandbergen 2015-03-31

    I believe the same is true for Android.
  6. Joshua Quick 2018-08-30

    I've re-tested with Titanium 7.3.0. The following URL successfully loads the image... http://api.coldtrick.com/mod/profile/icondirect.php?lastcache=1357651348&joindate=1357651236&guid=41&size=medium The following URL, which involves a redirect from http to https, successfully loads the image too... http://raw.githubusercontent.com/recurser/exif-orientation-examples/master/Portrait_1.jpg The following URL fails to load the image because the website has an invalid certificate. This is the correct behavior in this case. https://www.poweruprewards.com/SiteResources/i/catalog/lg/PaddysSnuggieL.jpg I'm going to close this ticket. The first 2 URLs I've tested have shown that this is resolved.

JSON Source