Show image thumbnail in form using calc plugin

Status
Not open for further replies.

fudge4u

Member
I have a list in which I have a calc element {new_mcdc_orders___image} to link to an image in another list {new_mcdc_items___item_image}. The native image element is set to: Show media in form "cropped, then thumbnail, then full sized". But in the form with the calc element, the image only shows full size.

Is there a way to have the thumbnail show in the form that has the calc element?

Ideally, I would like the full size image to pop up in a new tab when clicked, but not necessary.

Here is the calculation element code:
$path = '';
$db = JFactory::getDBO();
$query = "SELECT item_image FROM new_mcdc_items WHERE item_name = " . $db->Quote('{new_mcdc_orders___item_to_order}');
$db->setQuery($query);
$path = $db->loadResult();
return "<img src=$path>";
 
Thanks much! Exactly what I need.

To view the full size image in another tab upon clicking the image, what would I need to add? I assume it would be in the JavaScript panel of the element with the action "click".

change your code to:
PHP:
return '<img src="' . $path . '" height="50" width="50">';
 
Simple html modification:
PHP:
return '<a href="' . $path . '" target="blank"><img src="' . $path . '" height="50" width="50"></a>';
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top