Forums

Display image problem

Fredolino 04 Aug, 2019
Hello,

I would like to display a CC6-form photo that has been uploaded to a CF6 form and stored on the server.
The single file name is stored in a table in the "photo" column. Only if I attach the file name directly to the img-url, then the photo will be displayed to me.

I could not find the problem.

the form:
name: beob_foto_form
data provider: {var:read_beob}
action url: beof_id={data:beof_id}&article_id={data:article_id}
content-box:
<div><img src="components/com_chronoforms6/chronoforms/uploads/{Fund.photo}" /></div>

Events-tab: view-foto
{fn:read_beob}
{view:beob_foto_form}
{debug:read_beob}

the browser-grafic-info:
.../components/com_chronoforms6/chronoforms/uploads/%7Bfoto.photo%7D

and the debugger:
Array
(
    [log] => Array
        (
            [0] => SELECT `Fund`.`beof_id` AS `Fund.beof_id`, `Fund`.`user_id` AS `Fund.user_id`, `Fund`.`beo_id` AS `Fund.beo_id`, `Fund`.`mapid_v` AS `Fund.mapid_v`, `Fund`.`datum` AS `Fund.datum`, `Fund`.`species` AS `Fund.species`, `Fund`.`anzahl` AS `Fund.anzahl`, `Fund`.`stadium` AS `Fund.stadium`, `Fund`.`geschlecht` AS `Fund.geschlecht`, `Fund`.`beobachtung` AS `Fund.beobachtung`, `Fund`.`bestimmung` AS `Fund.bestimmung`, `Fund`.`bemerkung` AS `Fund.bemerkung`, `Fund`.`photo` AS `Fund.photo`, `Fund`.`created` AS `Fund.created`, `Fund`.`modified` AS `Fund.modified` FROM `mtb_beobachtung` AS `Fund` WHERE `Fund`.`beo_id` = '4051_2_s.jpg' AND `Fund`.`species` LIKE '%%' GROUP BY `Fund.beof_id`;
        )

    [var] => Array
        (
        )

)
healyhatman 05 Aug, 2019
Make sure you're saving the UPLOADED file name, from the file upload action, not the file name from the form data.

AAlsoi think src in your case needs to start with /
Fredolino 05 Aug, 2019
oh, ok...
but i have in the CF-Form this:

field_file31 (black lable)
group[{var:area_repeater2.key}][photo]
ID: photo_{var:area_repeater2.key}

upload12 (black lable)
path: {path:front}\uploads\
auto upload file fields: empty
custom files config: empty
file name provider: empty

or i must have in upload12 file name provider?
e.g. input: {var:upload12.file.observ_image}

the result in HTML in CC6:
<div><img src="components/com_chronoforms6/chronoforms/uploads/observ_image" /></div>
healyhatman 05 Aug, 2019
Have a look at the debug, specifically the file upload action.
Fredolino 05 Aug, 2019
Array
(
    [path] => /www/htdocs/v096152/__test1/components/com_chronoforms6/chronoforms/uploads/
    [group.[n].photo] => Array
        (
            [extensions] => Array
                (
                    [0] => jpg
                    [1] => jpeg
                )

        )

    [group.1.photo] => Array
        (
            [saved] => 1
        )

    [var] => Array
        (
            [group] => Array
                (
                    [1] => Array
                        (
                            [photo] => Array
                                (
                                    [path] => /www/htdocs/v096152/__test1/components/com_chronoforms6/chronoforms/uploads/20190805091345_pic63588-s.jpg
                                    [filename] => 20190805091345_pic63588-s.jpg
                                    [name] => pic63588_s.jpg
                                    [size] => 39074
                                )

                        )

                )

        )

)
healyhatman 05 Aug, 2019
So you need to save the filename to the database, as shown there.
Fredolino 05 Aug, 2019
Yes, that's the case for example in the database in the column "photo":
20190803175940_23021-22.jpg


and the image-url is now:
<[font color="#000000"]div[/font]><[font color="#000000"]img[/font] [font color="#000000"]src[/font]=[font color="#000000"]"components/com_chronoforms6/chronoforms/uploads/???"[/font] /></[font color="#000000"]div[/font]>
healyhatman 05 Aug, 2019
Well ??? doesn't look right, you're sure it's in the database correctly?
Fredolino 05 Aug, 2019
I have[color=rgb(0, 0, 0)] for example in the database in the column "photo" this:
20190803175940_23021-22.jpg[/color]

But how is the image url for my HTML code with CC6?[br]Is that then?
<div><img src="components/com_chronoforms6/chronoforms/uploads/[group.[n].photo]" /></div>
healyhatman 05 Aug, 2019
Shouldn't it be something like src="/components/com_chronoforms6/chronoforms/uploads/{var:tablelist.row.model.filename}" ?
Fredolino 05 Aug, 2019
I just understand train station :-)
If I enter this now in my HTML view at CC6:
<div><img src="components/com_chronoforms6/chronoforms/uploads/{var:beob_list.row.Fund.filename}" /></div>

I still do not see a picture .....
Or is it so that the upload photos first in the CF6 must have all the same file name?
For example: observ_img.jpg
The timestamp is attached automatically ...
Then the image URL must be in CC6:
<div><img src="components/com_chronoforms6/chronoforms/uploads/{var:beob_list.row.Fund.observ_img}" /></div>
healyhatman 05 Aug, 2019
You need to store the upload action filename in the database, and then READ that back from the database when it's time to display. What does the read_data look like? The debug for it?
Fredolino 05 Aug, 2019
:-)
Array
(
    [log] => Array
        (
            [0] => SELECT `Fund`.`beof_id` AS `Fund.beof_id`, `Fund`.`user_id` AS `Fund.user_id`, `Fund`.`beo_id` AS `Fund.beo_id`, `Fund`.`mapid_v` AS `Fund.mapid_v`, `Fund`.`datum` AS `Fund.datum`, `Fund`.`species` AS `Fund.species`, `Fund`.`anzahl` AS `Fund.anzahl`, `Fund`.`stadium` AS `Fund.stadium`, `Fund`.`geschlecht` AS `Fund.geschlecht`, `Fund`.`beobachtung` AS `Fund.beobachtung`, `Fund`.`bestimmung` AS `Fund.bestimmung`, `Fund`.`bemerkung` AS `Fund.bemerkung`, `Fund`.`photo` AS `Fund.photo`, `Fund`.`created` AS `Fund.created`, `Fund`.`modified` AS `Fund.modified` FROM `mtb_beobachtung` AS `Fund` WHERE `Fund`.`beo_id` = '20190805091151_pic63589.jpg' AND `Fund`.`species` LIKE '%%' GROUP BY `Fund.beof_id`;
        )

    [var] => Array
        (
        )

)
healyhatman 05 Aug, 2019
Right so there's NOTHING THERE, nothing has been loaded.
WHERE `Fund`.`beo_id` = '20190805091151_pic63589.jpg' AND `Fund`.`species` LIKE '%%' 
That's not right at all.
Fredolino 05 Aug, 2019
ok, i have a new read data in CC6
and this is the debug:
Array
(
    [log] => Array
        (
            [0] => SELECT `Fund`.`photo` AS `Fund.photo` FROM `mtb_beobachtung` AS `Fund` WHERE `Fund`.`user_id` = '909' AND `Fund`.`beo_id` = '20190805091345_pic63588-s.jpg';
        )

    [var] => Array
        (
        )

)
Fredolino 05 Aug, 2019
Answer
update ....
this is correct now?
Anyway, I see a photo now :-)

in my html in the form this url:
<div><img src="components/com_chronoforms6/chronoforms/uploads/{data:article_id}" /></div>

and the dubug of my read data:
rray
(
    [log] => Array
        (
            [0] => SELECT `Fund`.`beof_id` AS `Fund.beof_id`, `Fund`.`user_id` AS `Fund.user_id`, `Fund`.`beo_id` AS `Fund.beo_id`, `Fund`.`mapid_v` AS `Fund.mapid_v`, `Fund`.`datum` AS `Fund.datum`, `Fund`.`species` AS `Fund.species`, `Fund`.`anzahl` AS `Fund.anzahl`, `Fund`.`stadium` AS `Fund.stadium`, `Fund`.`geschlecht` AS `Fund.geschlecht`, `Fund`.`beobachtung` AS `Fund.beobachtung`, `Fund`.`bestimmung` AS `Fund.bestimmung`, `Fund`.`bemerkung` AS `Fund.bemerkung`, `Fund`.`photo` AS `Fund.photo`, `Fund`.`created` AS `Fund.created`, `Fund`.`modified` AS `Fund.modified` FROM `mtb_beobachtung` AS `Fund` WHERE `Fund`.`user_id` = '909' AND `Fund`.`beo_id` = '<img src=\"components/com_chronoforms6/chronoforms/uploads/20190805091151_pic63589.jpg\" />';
        )

    [var] => Array
        (
        )

)
healyhatman 05 Aug, 2019
WHY are you storing the uploaded image file name as the ID of your entry? Just..... WHY?
Fredolino 05 Aug, 2019
:-)
in the where conditions i had first:
beo_id = {data:article_id}
beo_id is the primary key from the main table
and the Foreign key in the second table
so i have just in the where conditions:
beo_id = <img src="components/com_chronoforms6/chronoforms/uploads/{data:article_id}" />
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger