sunnyjey
Active Member
I want to display the Photo as an Avatar. I have created the image Plugin.
I need to build the URL path for the image from another table. The URL should be:
https://www.mydomain.com/media/reviews/photos/rel_path/filename.extension
WHERE rel_path, filename and extension (jpg/jpeg/png) are Column Names from the Third Table.
View attachment 17256
I have created calc element with following code:
How do I select rel_path, filename and extension and construct the URL ?
I need to build the URL path for the image from another table. The URL should be:
https://www.mydomain.com/media/reviews/photos/rel_path/filename.extension
WHERE rel_path, filename and extension (jpg/jpeg/png) are Column Names from the Third Table.
View attachment 17256
I have created calc element with following code:
Code:
$url ='{$jConfig_live_site}media/reviews/photos/';
$photo = 'photo';
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select('rel_path, filename')
->from('mytable2_media')
->where('user_id = ' . $myDb->quote('{mytable1___userid_raw}'). ' and media_type = ' . $myDb->quote($photo));
$myDb->setQuery($myQuery);
$media = $myDb->loadResult();
return $url . $media ;
How do I select rel_path, filename and extension and construct the URL ?