[SOLVED] Get image with calc plugin

schacke

Member
Isn't this the right way?

This is the calculation:
$db =& JFactory::getDBO();
$query = "SELECT logo FROM dkbb_invoice_info WHERE user = '{$my->id}'";
$db->setQuery($query);
$path = $db->loadResult();
return '<img src="' . $path . '" alt=" " />';

And this is what's returned in the html:
<img alt="" psykolog-kbh-aarhus.png","params":"{\"rotation\":0,\"scale\":100,\"imagedim\":{\"x\":200,\"y\":200,\"w\":128,\"h\":60},\"cropdim\":{\"w\":200,\"h\":100,\"x\":200,\"y\":200},\"crop\":false,\"quality\":0.9,\"mainimagedim\":{\"x\":200,\"y\":200,\"w\":128,\"h\":60}}"}]"="" user-logo\="" images\="" file":"\="" src="/[{">
 
What should be in dkbb_invoice_info.logo?
$path looks like JSON encoded information , you have to extract your image name.
 
dkbb_invoice_info.logo is an file upload plugin.

The code is a copy/paste from this forum - hoped it worked.
 
The code should be ok for non-ajaxfied fileuploads.
Do you have an ajax fileupload with max files=1?
Can you add
Code:
...
$path = $db->loadResult();
var_dump($path);exit;
to see exactly what you get?
 
Yes: ajax with max 1

Should I just add the code or replace the last two lines? If I add, the result is the same. If I replace, I get a white screen with this text:
string(296) "[{"file":"\/images\/user-logo\/psykolog-kbh-aarhus.png","params":"{\"rotation\":0,\"scale\":100,\"imagedim\":{\"x\":200,\"y\":200,\"w\":128,\"h\":60},\"cropdim\":{\"w\":200,\"h\":100,\"x\":200,\"y\":200},\"crop\":false,\"quality\":0.9,\"mainimagedim\":{\"x\":200,\"y\":200,\"w\":128,\"h\":60}}"}]"
 
Try
Code:
$db =& JFactory::getDBO();
$query = "SELECT logo FROM dkbb_invoice_info WHERE user = '{$my->id}'";
$db->setQuery($query);
$js = $db->loadResult();
$result = json_decode($js);
$path = $result->file;
return '<img src="' . $path . '" alt=" " />';
(I assume there's a Fabrik function for doing the json_decode but I don't know)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top