no_image, when I upload a new record without a photo

Fredolino 20 Sep, 2019
Hi,
I save a new record with a photo.
The record and the photo will be displayed in a list in the Views Event.
When I upload a new record without a photo, I get a broken image link in the list.
I think that this broken link will not be displayed if I use a "no_image.png" here. What is the best solution here?

I have a "read_foto_check" and a switch (check_foto_exists) under Functions.
The switch will function as a test and will show me a message when a photo has been uploaded and saved.
Data provider:
{Var / empty: read_beob_arten_foto_check.BeoArt.beo_art_id}

values setup:
false: {success: photo is there.}
true: {fn: upload_foto} {fn: save_beob_new}

The photo in the Views list (Table) is a link (Elements Link).
content:
<img src = "components / com_chronoforms6 / chronoforms / uploads / {var: beob_arten_list.row.BeoArt.photo}" />
URL:
beo_art_id = {var: beob_arten_list.row.BeoArt.beo_art_id}
Class: modal

I have no idea how to install the no_image.png now if the new record is uploaded without a photo.
The no_image.png is of the server.
If a record with a photo is uploaded then no_image.png should be overwritten.
How do I have to change the switch? Maybe I have to create a function for "true"?

Maybe a PHP code?
<? php
if (! empty ($ this-> get ("read_beob_art.BeoArt.photo"))) {)
  echo '<img src = "/ components / com_chronoforms6 / chronoforms / uploads / {var: read_beob_art.BeoArt.photo}" />';
} else {
  echo '<img src = "/ components / com_chronoforms6 / chronoforms / uploads / no_image.png" />';
}
?>

Or maybe it is easier?

Many thanks for the help.
F.
This topic is locked and no more replies can be posted.