MG 1.1 Edit embed text

When I click a media gallery image to insert it into a post, text in the following format is automatically added:

IMAGE_NAME by USER_NAME posted May 28, 2016 at 11:57 PM

How can I change this so that the image description is shown and not the user name and upload date?
Can anyone tell me which file to edit?

Thank you,
Evan
 
The phrase is named "xengallery_x_by_y_posted_z".

That's used in the xengallery_browser_editor_content template.

You would need to change this:
Code:
data-title="{xen:phrase xengallery_x_by_y_posted_z, 'title={$item.media_title}', 'user={$item.username}', 'date={xen:datetime $item.media_date, absolute}'}"

To this:
Code:
data-title="{xen:phrase xengallery_x_by_y_posted_z, 'title={xen:if $item.media_description, $item.media_description, $item.media_title}', 'user={$item.username}', 'date={xen:datetime $item.media_date, absolute}'}"

Note, it will display a description if there is one, else it will display the title. (Descriptions are optional, titles are not, so it's good to keep that as a fallback).
 
Chris,

I got things working with only one minor cosmetic issue.
After the gallery image is embeded, there is a significant amount of white space (about 3 blank lines) before the post continues.
Is there a way to reduce this? Perhaps by editing the BB_Code template or something?
 
We already trim some leading lines when we render the BB code, and in my testing I can't reproduce any excess white space:
Code:
Test
[GALLERY=media, 1]Logo.og by Chris D posted May 31, 2016 at 7:11 PM[/GALLERY]
Test

Produces:
upload_2016-5-31_19-13-40.webp

Which seems ok to me.
 
Yes, what you have looks fine. Mine is different because I tweaked a couple things.

embed.webp


As you can see, I have a lot of space between the image and the description.
I changed two things:

xengallery_browser_editor_content
BEFORE: data-title="{xen:phrase xengallery_x_by_y_posted_z, 'title={$item.media_title}', 'user={$item.username}', 'date={xen:datetime $item.media_date, absolute}'}"
AFTER: data-title="{$item.media_description}"

js/xengallery/min/gallery_bb_code.js
BEFORE: a="[GALLERY="+a.data("type")+", "+a.data("id")+"]"+XenForo.htmlspecialchars(a.data("title"))+"[/GALLERY]";
AFTER: a="[GALLERY="+a.data("type")+", "+a.data("id")+"]"+"[/GALLERY]<font size=3>"+a.data("title")+"</font><br><br>";

I bypassed "xengallery_x_by_posted_z" entirely and used the Description to populate the image title.
This is a temporary thing because I needed to embed about 1,500 images along with their descriptions.

What I really want is just the description right below the image, but I was trying to avoid it being hyperlinked (and I wanted to use a smaller font).
 
I would recommend undoing some of the changes you've made to see if that narrows down which has caused the issue.

It's never recommended to modify core files, so you should revert those changes ASAP. Not least because the specific change you've done actually introduces a security issue known as a XSS vulnerability.

I should note that the JS code has "<br><br>" at the end so this could explain the extra line breaks.
 
I plan to undo all changes. This was a temporary thing so that I could get 1,500 images embeded. I plan to restore everything to the original now that I'm done.
Once I do, will it affect all the existing embeds or just subsequent ones?

The <br><br> is after description text - not before.
 
Top Bottom