Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOs image loading fine in Xcode simulator but not on the device itself. #252

Open
CapstoneUX opened this issue Oct 2, 2020 · 0 comments

Comments

@CapstoneUX
Copy link

RangeCollectionCell.prototype.drawCell = function() {

this.addClass("rangeCollection");
this.viewElement.style.width = "50%";
this.viewElement.style.display = "inline-block"
this.row_content.style.position = "relative";

this.imageView = document.createElement('a');
this.imageView.className = "range-image";
this.imageView.style.display = "block";
this.imageView.style.position = "absolute";
this.imageView.style.left = "9px"; 
this.imageView.style.right = "9px";
this.imageView.style.top = "20px";
this.imageView.style.height = "165px";
this.imageView.style.border = "1px solid #aaa";
this.imageView.style.backgroundImage = "url('"+app.url+"/app/brand/placeholder')";
this.imageView.href = "/uploads/product_images/"+this.range.RANGECODE+".jpg";
this.imageView.style.backgroundSize = "contain";
this.imageView.style.backgroundRepeat = "no-repeat";
this.imageView.style.backgroundPosition = "center center";

//Lazy load the product image
if(this.range.IMAGE_EXISTS) {
    var self = this;
    var img = new Image();

    ImgCache.isCached(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg", function(path, success){
        if(success){
            ImgCache.getCachedFileURL(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg",
                function (src, url) {
                    if (device.platform == "browser") {
                        url = src;
                    }
                
                    img.src = url;
                    self.imageView.href = url;
                    self.imageView.style.backgroundImage = "url(" + url + ")";
                    self.imageView.setAttribute("data-fresco-group", "gallery");
                    self.imageView.className += " fresco";
                }
            );
        } else {
            ImgCache.cacheFile(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg", function () {
                ImgCache.getCachedFileURL(app.url+"/uploads/product_images/"+self.range.RANGECODE+".jpg",
                    function (src, url) {
                    
                        if (device.platform == "browser") {
                            url = src;
                        }
                        img.src = url;
                        self.imageView.href = url;
                        self.imageView.style.backgroundImage = "url(" + url + ")";
                        self.imageView.setAttribute("data-fresco-group", "gallery");
                        self.imageView.className += " fresco";
                    }
                );
            });
        }
    })
}

this.row_content.appendChild(this.imageView);

var name = document.createTextNode(this.range.RANGE_NAME);
this.textLabel = document.createElement('label');
this.textLabel.className = "rangeLabel";
this.textLabel.appendChild(name);
this.textLabel.style.position = "absolute";
this.textLabel.style.left = "9px";
this.textLabel.style.right = "9px";
this.textLabel.style.bottom = "10px";
this.textLabel.style.textAlign = "center";
this.row_content.appendChild(this.textLabel);


return this.row_content;

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant