[#6456] CBGallery - add alt attribute

7 years 2 months ago - 7 years 2 months ago #290429 by bazik666
[#6456] CBGallery - add alt attribute was created by bazik666
Hello,

First question:

i'm trying to display alt attribute to image, that is shown in profile gallery.

I found in components\com_comprofiler\plugin\libraries\CB\Plugin\Gallery\Table\ItemTable.php -> 1340 line, where is
return '<img src="' . htmlspecialchars( $previewPath ) . '" class="galleryImage cbImgPict cbThumbPict img-thumbnail' . $rotate . '" />';

F.e. i would like to put a title of file in alt, like this
<img ALT="'.$this->title.'" src="'
, is there a chance to do that? I'm not sure if i can get any data from comprofiler_plugin_gallery_items in this part of code. If not, where i can do that?

----

Second question:
i can see, that gallery is displaying images in way, i don't understand. There is img src (or background-image), but after that there is URL instead file.jpg. So for example
"option=com_comprofiler&view=pluginclass&plugin=cbgallery&action=item&func=show&id=78&gallery=27ee18ff5208ae2c3fe57240e7be4f6d&Itemid=169&format=raw"
, can You tell me, where this image is generating?

I tried to figure out, and find where is function show for action item, but it's not clear for me.

Regards,
Luke

Please Log in to join the conversation.

7 years 2 months ago #290443 by krileon
Replied by krileon on topic CBGallery - add alt attribute
The images are output by PHP. There is no direct image access unless it's a linked image. I've added a feature ticket to add alt text to all img tag outputs in CB Gallery.

forge.joomlapolis.com/issues/6456

If you want to add the alt attribute your self you can, but you need to ensure whatever you add is escaped with htmlspecialchars before doing so. If unsure how to do this I recommend leaving it as is and waiting for it to be implemented.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

7 years 2 months ago #290500 by bazik666
Replied by bazik666 on topic CBGallery - add alt attribute
In fact, i try to do hidden images. I add to database field "hidden" and i modified code, that when image is uploading there is a new field in form (hidden yes / no). It's working good in upload and edit.

Now i try to hide images, that have been set as hidden, that's why i asked if i can add alt to img. If i can do that, i could make
if ($this->hidden) ...htmlspecialchars($previewPath) ... else ...img src="locked.jpg"

Please Log in to join the conversation.

7 years 2 months ago - 7 years 2 months ago #290536 by krileon
Replied by krileon on topic CBGallery - add alt attribute
We do not support core edits and can not advise you on them. You can find all the template files for CB Gallery at the below location where you can likely make your edits where the image is output.

components/com_comprofiler/plugin/user/plug_cbgallery/templates/default/

Specifically item_container.php is all you should need to override. To do this copy the default template folder and delete everything except item_container.php and index.html. Next in CB Gallery select your new template. You can now edit it freely without changes being lost on upgrade. If you need to change activity display you'll also want to keep activity.php.

Note profile galleries can be protected by protecting the Gallery tab using CB Privacy. This will block the entire output of that gallery and its entries based of privacy. Next major CB Privacy release should allow for image by image privacy controls though.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.223 seconds

Facebook Twitter LinkedIn