project/src/main/webapp/shared.js
/**
 * Adds currently-attributed image
 * If no image, add a default image or background color with default height
 */
Adds currently-attributed image
If no image, add a default image or background color with default height
Adds currently - attributed image If no image add a default image or background color with default height
async function populateExistingImage(type, selector, eventId = '') {
  if (!eventId) {
    eventId = getEventId();
  }
  const blobKey = await getBlobKey(type, eventId);
  const blobResponse = await fetch(`/blob-serve?key=${blobKey}`);
  if (blobResponse.status !== 200) {
    if (type === 'event') {
      createRandomColorBlock(selector);
    } else if (type === 'profile') {
      $(selector).attr('src', 'assets/default_profile.jpg');
    }
  } else {
    const imageBlob = await blobResponse.blob();
    $(selector).attr('src', URL.createObjectURL(imageBlob));
  }
}
async function populateExistingImage ( type , selector , eventId = '' ) { if ( ! eventId ) { eventId = getEventId ( ) ; } const blobKey = await getBlobKey ( type , eventId ) ; const blobResponse = await fetch ( ` ${ blobKey } ` ) ; if ( blobResponse . status !== 200 ) { if ( type === 'event' ) { createRandomColorBlock ( selector ) ; } else if ( type === 'profile' ) { $ ( selector ) . attr ( 'src' , 'assets/default_profile.jpg' ) ; } } else { const imageBlob = await blobResponse . blob ( ) ; $ ( selector ) . attr ( 'src' , URL . createObjectURL ( imageBlob ) ) ; } }
Adds currently-attributed image
 If no image, add a default image or background color with default height
Adds currently - attributed image If no image add a default image or background color with default height