# Hide Card Image if Empty

**URL:** https://community.glideapps.com/t/hide-card-image-if-empty/19976
**Category:** Report a Bug
**Created:** [December 17, 2020, 5:01am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976 "2020-12-17T05:01:08Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [December 17, 2020, 5:01am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/1 "2020-12-17T05:01:08Z")

</div>

Hi @Mark or whoever can assist—

The cards layout needs to have a way to hide the image container when there is no image to display. Otherwise, it’s just ugly:

Thoughts on how to address this in the meanwhile?  
EDIT: used a generate image column to fill the gap for now, but it still sticks out like a sore thumb.

---

<div class="post-metadata">

### Author: ![Rosewebstudio](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rosewebstudio/32/12261_2.png) [@Rosewebstudio](https://community.glideapps.com/u/Rosewebstudio)
#### Post date: [December 17, 2020, 8:01am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/2 "2020-12-17T08:01:03Z")

</div>

@Robert_Petitto maybe something like this in meantime - just a thought [https://pravatar.cc/](https://pravatar.cc/) with some kind of indication “awaiting image”

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [December 17, 2020, 8:07am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/3 "2020-12-17T08:07:53Z")

</div>

Yeah, but only if I was requiring an image to be there—some posts won’t have any images.

---

<div class="post-metadata">

### Author: ![Rosewebstudio](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/rosewebstudio/32/12261_2.png) [@Rosewebstudio](https://community.glideapps.com/u/Rosewebstudio)
#### Post date: [December 17, 2020, 8:21am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/4 "2020-12-17T08:21:22Z")

</div>

Ahh I get you, fair point Sir…

Quick q - is it a bug though or a feature request? (just saying) Wink 😉

---

<div class="post-metadata">

### Author: ![kyleheney](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/kyleheney/32/41173_2.png) [@kyleheney](https://community.glideapps.com/u/kyleheney)
#### Post date: [December 17, 2020, 11:15am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/5 "2020-12-17T11:15:40Z")

</div>

Same is true for Tags. If a tag is empty, there is still an ugly placeholder for it that changes the size of the card.

---

<div class="post-metadata">

### Author: ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)
#### Post date: [December 19, 2020, 5:15am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/6 "2020-12-19T05:15:13Z")

</div>

The good news is when the api column arrives you can use that image search to automatically fill in blank images with a if then column, if blank then api image otherwise use their image.

---

<div class="post-metadata">

### Author: ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)
#### Post date: [December 19, 2020, 5:18am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/7 "2020-12-19T05:18:33Z")

</div>

Robert you could plug that API directly into scripts right now actually and do it that way in the meantime.

---

<div class="post-metadata">

### Author: ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)
#### Post date: [December 19, 2020, 5:19am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/8 "2020-12-19T05:19:16Z")

</div>

Ya…I’m just using the generate image column for now—client is okay with it.

---

<div class="post-metadata">

### Author: ![Drearystate](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/drearystate/32/49605_2.png) [@Drearystate](https://community.glideapps.com/u/Drearystate)
#### Post date: [December 19, 2020, 5:20am UTC](https://community.glideapps.com/t/hide-card-image-if-empty/19976/9 "2020-12-19T05:20:47Z")

</div>

Oh…well…here’s a quick API call…

```
functionGetAPI(){
var response = 
UrlFetchApp.fetch("https://www.thecocktaildb.com/api/json/v1/1/randomselection.php")
Logger.log(response.getContentText());
  var fact = response.getContentText();
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('A5').activate();
  spreadsheet.setActiveSheet(spreadsheet.getSheetByName('Sheet1'), true);
  spreadsheet.getRange(spreadsheet.getLastRow() + 1,1).setValue([fact]);
   }

```

Then you would just have to get the info from the call like this

```
function callDrink() {

 var response = UrlFetchApp.fetch("https://www.thecocktaildb.com/api/json/v1/1/filter.php? 
a=Alcoholic");

  // Parse the JSON reply
   var json = response.getContentText();
   var data = JSON.parse(json);

 Logger.log(data);
 Logger.log(data["results"]);
 Logger.log(data["results"][0]);
 Logger.log(data["results"][0]["artistName"]);
 Logger.log(data["results"][0]["collectionName"]);
 Logger.log(data["results"][0]["artworkUrl60"]);
 Logger.log(data["results"][0]["previewUrl"]);
}

```

This one listed doesn’t actually work with this url i was just copying and pasting from my scripts real quick.
