Image caption from file manager

Permalink Browser Info Environment
Hi Jordan, might it be possible to add the Description attribute from file manager to the Image?
I saw this Add-On:http://www.concrete5.org/marketplace/addons/image-captions/...
but it don't use the Description attribute.

Regards

Torsten

Type: Discussion
Status: New
tsilbermann
View Replies:
jordanlev replied on at Permalink Reply
jordanlev
You can get an image's description by modifying your block's controller.php file and its view.php file.

First, in controller.php, find this line of code:
return $image

...and just ABOVE that line of code, add this new line:
if (isset($file)) { $image['description'] = $file->getDescription(); }


Then, in view.php, you can output the description wherever you want with this code:
<?php echo htmlentities($field_2_image->description, ENT_QUOTES, APP_CHARSET); ?>


Hope that helps.

-Jordan
tsilbermann replied on at Permalink Reply 1 Attachment
tsilbermann
Hi Jordan,

when i add the code (in controller.php) the page crashes (edit bar is gone, elements are wrong aligned).
I attached the block.

Thanks

Torsten
jordanlev replied on at Permalink Reply
jordanlev
The example code I gave is just an example -- you will need to change the name of the fields in view.php.

If you change $field_2_image->description to $field_1_image->description, that should fix it.

Best,
Jordan

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.