Buy Now
Sign in

no_image, when I upload a new record without a photo

Fredolino , September 20 2019, 16:58
Fredolino 533
September 20 2019, 16:58 #389263
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"))) {)
&nbsp; echo '<img src = "/ components / com_chronoforms6 / chronoforms / uploads / {var: read_beob_art.BeoArt.photo}" />';
} else {
&nbsp; echo '<img src = "/ components / com_chronoforms6 / chronoforms / uploads / no_image.png" />';
}
?>
Or maybe it is easier?
Many thanks for the help.
F.
Fredolino 533
September 21 2019, 10:36 #389265
solved :-)