Add placeholder image when previous snapshot can't be loaded

This commit is contained in:
Zach Fox 2017-05-31 10:11:59 -07:00
parent 4a52f4090d
commit 0441d8c703
3 changed files with 23 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View file

@ -293,19 +293,25 @@ function addImage(image_data, isLoggedIn, canShare, isGifLoading, isShowingPrevi
isGif = img.src.split('.').pop().toLowerCase() === "gif";
imageContainer.appendChild(img);
document.getElementById("snapshot-images").appendChild(imageContainer);
paths.push(image_data.localPath);
if (isGif) {
imageContainer.innerHTML += '<span class="gifLabel">GIF</span>';
}
if (!isGifLoading) {
appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast);
}
if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) {
shareForUrl(id);
}
if (isShowingPreviousImages && isLoggedIn && image_data.story_id) {
updateShareInfo(id, image_data.story_id);
}
img.onload = function () {
paths.push(image_data.localPath);
if (isGif) {
imageContainer.innerHTML += '<span class="gifLabel">GIF</span>';
}
if (!isGifLoading) {
appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast);
}
if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) {
shareForUrl(id);
}
if (isShowingPreviousImages && isLoggedIn && image_data.story_id) {
updateShareInfo(id, image_data.story_id);
}
};
img.onerror = function () {
img.onload = null;
img.src = image_data.errorPath;
};
}
function showConfirmationMessage(selectedID, destination) {
if (selectedID.id) {

View file

@ -273,7 +273,8 @@ function fillImageDataFromPrevious() {
localPath: previousStillSnapPath,
story_id: previousStillSnapStoryID,
blastButtonDisabled: previousStillSnapBlastingDisabled,
hifiButtonDisabled: previousStillSnapHifiSharingDisabled
hifiButtonDisabled: previousStillSnapHifiSharingDisabled,
errorPath: Script.resolvePath(Script.resourcesPath() + 'snapshot/img/no-image.jpg')
});
}
if (previousAnimatedSnapPath !== "") {
@ -281,7 +282,8 @@ function fillImageDataFromPrevious() {
localPath: previousAnimatedSnapPath,
story_id: previousAnimatedSnapStoryID,
blastButtonDisabled: previousAnimatedSnapBlastingDisabled,
hifiButtonDisabled: previousAnimatedSnapHifiSharingDisabled
hifiButtonDisabled: previousAnimatedSnapHifiSharingDisabled,
errorPath: Script.resolvePath(Script.resourcesPath() + 'snapshot/img/no-image.jpg')
});
}
}