Titanium Appcelerator Photo Gallery (Show photo grid based on list from server)

I'm having trouble presenting Photo Gallery in the Titanium Appcelerator app (iPhone app). At the moment, I actually do not have an example code to share, because I do not understand how exactly this should work.

I just want to name my server for a list of images and show these images in a grid as thumbnails that can be viewed in full screen, for example, what you usually expect from the phone’s photo gallery.

In the whole sample code that I looked at, he talks about saving photos on the phone. I really don’t need to save all the photos of events for how many tents there are on the phone before displaying, right?

How can I iterate over a list of URLs to display in a grid in a standard way?

Thanks in advance for your help.

+3
source share
1 answer
var newsFeed = Titanium.Facebook.requestWithGraphPath('me/feed', {}, 'GET', function(e) {
        if (e.success) {
            var videoObjs = new Array();
            var result = (JSON.parse(e.result)).data;

            for(var c = 0; c < result.length;c++) {
                if(result[c].type == 'video') {
                    var vid = result[c].source.substring((result[c].source.indexOf("/v/"))+3, (result[c].source.indexOf('?')));
                    vidInfo = {
                        vGuid:vid,
                        thumb:"http://img.youtube.com/vi/"+vid+"/0.jpg",
                        descr:result[c].name
                    };
                    videoObjs.push(vidInfo);
                }
            }
            updateTable(videoObjs);
            buildCoverFlow(videoObjs);
            buildDashboard(videoObjs);
        } else if (e.error) {
            alert(e.error);
        } else {
            alert('Unknown response');
        }
    });

var tableData = [];
    var colorSet = [
    "#D44646",
    "#46D463",
    "#46D4BE",
    "#C2D446",
    "#D446D5",
    "#4575D5",
    "#E39127",
    "#879181",
    "#E291D4"
    ];

    var cellWidth = 240;
    var cellHeight = 180;
    var xSpacer = 12;
    var ySpacer = 20;
    var xGrid = 3;
    var yGrid = parseInt(videoObjs.length / 3);
    thumbProps = {
        xSpace : xSpacer,
        cellH : cellHeight,
        cellW : cellWidth
    }
    for (var y=0; y<yGrid; y++) {
        var thisRow = Ti.UI.createTableViewRow({
            className: "grid",
            layout: "horizontal",
            height: cellHeight+(2*ySpacer),
            selectedBackgroundColor:"red",
            backgroundColor:"black"
        });
        for (var x=0; x<xGrid; x++) {
            var index = x + xGrid * y;
            var videoObj = videoObjs[index];
            var thisView = createPlayerThumb(videoObj, thumbProps);
            thisRow.add(thisView);
        }
        tableData.push(thisRow);
    }
    tableview.data = tableData;
    tableview.separatorColor = 'black';
    galWin.add(tableview);

    tableview.addEventListener("click", function(e) {
        if(e.source.objName) {
            Ti.API.info("---> " + e.source.objName+e.source.objIndex + " was clicked!");
        }
    });
}


That code I wrote for building an array of youtube thumbnails from a given facebook feed for the iPad.  Should be a good start.
+3
source

All Articles