• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

CDD with Picture

Good morning

Is it possible to have a picture appear in a CDD element?

I have a fileupload element that uploads a picture of the person and I want to display it on a search form I have created. My setup is as follows

DB Join (Auto Complete) >>

Name (CDD) >>

Town (CDD) >>

Picture (CDD) (Not sure how to display picture of the record?)

Thanks for any guidance

Regards

Mark
 
Last edited:
Thansk Hugh

What I'm trying to do is to search for members and have their image display - Is it possible to do with any other element, with a calc element maybe?

Thanks
 
Btw, iirc the only way to get images in SELECTs is using CSS bg images.

Yes, should be possible with a calc, with AJAX enabled. But you'd have to roll your own query code to get the upload element, something like ...

Code:
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('upload')->from('yourtable')->where('id = ' . $myDb->quote('{thistable___dbjoin_raw}'));
$myDb->setQuery($myQuery);
$myUpload = $myDb->loadResult();
if (!empty($myUpload)) {
   return '<img src="' . $myUpload . '">';
}
return 'frowny face y u no have pikture?';

Obviously change stuff as applicable, table name, element name, etc.

Leave the frowny face msg tho, I kinda like that.

-- hugh
 
Thanks hugh I have added that and it works to a degree but I have the following issue, (I'll try to explain as best I can)

My table where I store the data is called tenant_rep

When I added the image element it created a table with the name tenant_rep_repeat_picture

The code you supplied looks like this

PHP:
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery->select('picture')->from('tenant_rep_repeat_picture')->where('id = ' . $myDb->quote('{___tenants_name_raw}'));
$myDb->setQuery($myQuery);
$myUpload = $myDb->loadResult();
if (!empty($myUpload)) {
   return '<img src="' . $myUpload . '">';
}
return 'frowny face y u no have pikture?';

When I test it the wrong picture is displayed. For example, I lookup Alasdair Melville (id of 15 in tenants_rep table - attached picture 1) it displays a picture of another tenant from the tenant_rep_repeat_picture (picture 2) with an id of 15 - So I am guessing that I have to somehow "join" the two together to get the right picture?

Picture 1
tenats_rep.png


Picture 2
tenants_rep_repeat_picture.png


I hope that makes sense?

Thanks

Mark
 
I'm just puzzled as to why it's using a repeat table. That should only happen if you select "AJAX upload" as an option on the upload element.

Anyway ... did you try what I suggested above, of specifying parent_id instead of id in the where()?

-- hugh
 
I haven't checked yet as I'm not in front of my pc - let me finish dinner and I'll try on my iPad

Regards



Sent from my iPhone using Tapatalk
 
Hi Hugh

That's works! Sorry I should have realised - I think i got a bit "code blind" when I'm not even a coder!

Thanks again for your time :)

Regards

Mark
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top