- Joined
 - Sep 24, 2023
 
- Messages
 - 3
 
- Points
 - 3
 
Reputation:
Hello, I have a problem with XenForo Media Gallery 2.2.5 Share Links
I don't know if it's normal, but I'm getting incorrect links to the uploaded image.
With the links provided I can only post in my own forum, but I would also like to use the link in other forums
This link is issued by the XenForo Media Gallery 2.2.5: https://xxxxxxxxxxx.xx/media/domin.5/full
but the XenForo Media Gallery 2.2.5 saved the file here: https://xxxxxxxxxx.xx/data/xfmg/thumbnail/0/5-41a27622ca41a110c7a36c3533602983.jpg
It should actually output this link. I've searched many forums but haven't found anything about this. I now know that this will or must be a template modification.
I think I have already found the template responsible.
xfmg_media_view_macros The output code starts from line 444
The output line in question is 464, but I have no idea what I have to change it to so that the file link is output to me.
I also found out that the Pinterest share button outputs the correct link/url
Pinterest Code
	
	
	
		
Maybe someone knows how it would work.
	
	
	
		
	
		
			
		
		
	
			
			I don't know if it's normal, but I'm getting incorrect links to the uploaded image.
With the links provided I can only post in my own forum, but I would also like to use the link in other forums
This link is issued by the XenForo Media Gallery 2.2.5: https://xxxxxxxxxxx.xx/media/domin.5/full
but the XenForo Media Gallery 2.2.5 saved the file here: https://xxxxxxxxxx.xx/data/xfmg/thumbnail/0/5-41a27622ca41a110c7a36c3533602983.jpg
It should actually output this link. I've searched many forums but haven't found anything about this. I now know that this will or must be a template modification.
I think I have already found the template responsible.
xfmg_media_view_macros The output code starts from line 444
The output line in question is 464, but I have no idea what I have to change it to so that the file link is output to me.
I also found out that the Pinterest share button outputs the correct link/url
Pinterest Code
		Code:
	
	<xf:if is="$xf.options.pinterestShare">
<a class="shareButtons-button shareButtons-button--brand shareButtons-button--pinterest" data-href="https://pinterest.com/pin/create/bookmarklet/?url={url}&description={title}&media={image}">
<i aria-hidden="true"></i>
<span>{{ phrase('pinterest') }}</span>
</a>
</xf:if>
	Maybe someone knows how it would work.
		Code:
	
	xfmg_media_view_macros Code
<xf:macro name="media_status" arg-mediaItem="!" arg-block="{{ true }}">
    <xf:set var="$inner">
        <xf:if contentcheck="true">
            <dl class="blockStatus">
                <dt>{{ phrase('status') }}</dt>
                <xf:contentcheck>
                    <xf:if is="$mediaItem.album_id AND $mediaItem.Album AND $mediaItem.Album.album_state == 'deleted'">
                        <dd class="blockStatus-message blockStatus-message--deleted">
                            {{ phrase('xfmg_media_item_is_contained_within_deleted_album') }}
                            <xf:macro template="deletion_macros" name="notice" arg-log="{$mediaItem.Album.DeletionLog}" />
                        </dd>
                    </xf:if>
                    <xf:if is="$mediaItem.media_state == 'deleted'">
                        <dd class="blockStatus-message blockStatus-message--deleted">
                            {{ phrase('xfmg_media_item_is_deleted') }}
                            <xf:macro template="deletion_macros" name="notice" arg-log="{$mediaItem.DeletionLog}" />
                        </dd>
                        <xf:elseif is="$mediaItem.media_state == 'moderated'" />
                        <dd class="blockStatus-message blockStatus-message--moderated">
                            {{ phrase('awaiting_approval_before_being_displayed_publicly') }}
                        </dd>
                    </xf:if>
                    <xf:if is="$mediaItem.warning_message">
                        <dd class="blockStatus-message blockStatus-message--warning">
                            {$mediaItem.warning_message}
                        </dd>
                    </xf:if>
                    <xf:if is="$mediaItem.isIgnored()">
                        <dd class="blockStatus-message blockStatus-message--ignored">
                            {{ phrase('you_are_ignoring_content_by_this_member') }}
                        </dd>
                    </xf:if>
                </xf:contentcheck>
            </dl>
        </xf:if>
    </xf:set>
    <xf:if is="$row">
        <div class="block">
            <div class="block-outer">
                {$inner|raw}
            </div>
        </div>
    <xf:else />
        {$inner|raw}
    </xf:if>
</xf:macro>
<xf:macro name="media_content" arg-mediaItem="!" arg-mediaNotes="{{ [] }}" arg-linkMedia="{{ false }}">
    <xf:if is="$mediaItem.media_type == 'image'">
        <div class="media-container-image js-mediaContainerImage">
            <xf:foreach loop="$mediaNotes" value="$note">
                <xf:macro name="note_view" arg-mediaItem="{$mediaItem}" arg-note="{$note}" />
            </xf:foreach>
            <xf:set var="$imageHtml">
                <img src="{{ link('media/full', $mediaItem, {'d': $mediaItem.last_edit_date ?: null}) }}"
                     width="{$mediaItem.Attachment.width}" height="{$mediaItem.Attachment.height}"
                     alt="{$mediaItem.title}" class="js-mediaImage" />
            </xf:set>
            <xf:if is="$linkMedia">
                <a href="{{ link('media', $mediaItem) }}">{$imageHtml|raw}</a>
            <xf:else />
                {$imageHtml|raw}
            </xf:if>
        </div>
    <xf:elseif is="$mediaItem.media_type == 'video'" />
        <div class="bbMediaWrapper">
            <div class="bbMediaWrapper-inner">
                <video preload="metadata" controls poster="{$mediaItem.poster_url}" data-video-type="video">
                    <source src="{$mediaItem.getVideoUrl()}" type="video/mp4" />
                    <div class="bbMediaWrapper-fallback">{{ phrase('your_browser_is_not_able_to_display_this_video') }}</div>
                </video>
            </div>
        </div>
    <xf:elseif is="$mediaItem.media_type == 'audio'" />
        <xf:set var="$audioItem">
            <video preload="metadata" controls poster="{$mediaItem.poster_url}" data-video-type="audio">
                <source src="{$mediaItem.getAudioUrl()}" type="audio/mpeg" />
                <div class="bbMediaWrapper-fallback">{{ phrase('xfmg_your_browser_is_not_able_to_play_this_audio') }}</div>
            </video>
        </xf:set>
        <xf:if is="$mediaItem.hasPoster() OR $mediaItem.hasThumbnail()">
            <div class="bbMediaWrapper">
                <div class="bbMediaWrapper-inner">
                    {$audioItem|raw}
                </div>
            </div>
        <xf:else />
            {$audioItem|raw}
        </xf:if>
    <xf:elseif is="$mediaItem.media_type == 'embed'" />
        {{ bb_code($mediaItem.media_tag, 'xfmg_media', $mediaItem) }}
    </xf:if>
</xf:macro>
<xf:macro name="media_film_strip" arg-mediaItem="!" arg-filmStripParams="!">
    <xf:if is="$filmStripParams.mediaItems is not empty">
        <xf:js src="xfmg/film_strip.js" min="1" />
        <xf:css src="xfmg_media_list.less" />
        <div class="block-outer">
            <div class="block-outer-middle">
                <div class="itemList itemList--strip js-filmStrip">
                    <a data-xf-click="inserter" data-replace=".js-filmStrip"
                        tabindex="0" role="button"
                        data-inserter-href="{{ link('media/film-strip-jump', $mediaItem, {'direction': 'prev', 'jump_from_id': $filmStripParams.firstItem.media_id}) }}"
                        rel="nofollow"
                        class="js-filmStrip-button itemList-button itemList-button--prev{{ !$filmStripParams.hasPrev ? ' is-disabled' : '' }}">
                        <i class="itemList-button-icon"></i>
                    </a>
                    <xf:foreach loop="$filmStripParams.mediaItems" value="$item">
                        <div class="js-filmStrip-item itemList-item">
                            <a href="{{ link('media', $item) }}">
                                {{ xfmg_thumbnail($item, 'xfmgThumbnail--fluid xfmgThumbnail--iconSmallest' . ($item.media_id == $mediaItem.media_id ? ' is-selected': ''), true) }}
                            </a>
                        </div>
                    </xf:foreach>
                    <a data-xf-click="inserter" data-replace=".js-filmStrip"
                        tabindex="0" role="button"
                        data-inserter-href="{{ link('media/film-strip-jump', $mediaItem, {'direction': 'next', 'jump_from_id': $filmStripParams.lastItem.media_id}) }}"
                        rel="nofollow"
                        class="js-filmStrip-button itemList-button itemList-button--next{{ !$filmStripParams.hasNext ? ' is-disabled' : '' }}">
                        <i class="itemList-button-icon"></i>
                    </a>
                </div>
            </div>
        </div>
    </xf:if>
</xf:macro>
<xf:macro name="media_film_strip_placeholders" arg-count="!">
    <xf:if is="$count">
        <xf:foreach loop="{{ range(1, $count) }}" value="$null">
            <div class="js-filmStrip-item itemList-item itemList-item--placeholder">
                <img src="{{ transparent_img() }}" />
            </div>
        </xf:foreach>
    </xf:if>
</xf:macro>
<xf:macro name="note_view" arg-mediaItem="!" arg-note="!">
    <div class="mediaNote js-mediaNote"
        data-note-data="{$note.note_data|json}"
        data-note-id="{$note.note_id}"></div>
    <div class="mediaNote-tooltip js-mediaNoteTooltip{$note.note_id}">
        <div class="noteTooltip-row">
            <xf:if is="$note.note_type == 'note'">
                {{ structured_text($note.note_text) }}
            <xf:elseif is="$note.note_type == 'user_tag'" />
                <div class="contentRow contentRow--alignMiddle">
                    <div class="contentRow-figure">
                        <xf:avatar user="$note.TaggedUser" defaultname="{$note.username}" size="xs" />
                    </div>
                    <div class="contentRow-main contentRow-main--close">
                        <xf:username user="$note.TaggedUser" defaultname="{$note.username}" rich="true" />
                        <xf:if is="$note.TaggedUser">
                            <div class="contentRow-minor">
                                <xf:usertitle user="$note.TaggedUser" />
                            </div>
                        </xf:if>
                    </div>
                </div>
            </xf:if>
        </div>
        <div class="noteTooltip-footer noteTooltip-footer--smallest">
            <ul class="listInline listInline--bullet">
                <li><xf:fa icon="fa-user" title="{{ phrase('xfmg_note_by')|for_attr }}" /> <xf:username user="{$note.User}" defaultname="{$note.username}" class="u-concealed" /></li>
                <xf:if is="$note.canApproveReject()">
                    <li>
                        <xf:fa icon="fa-check" title="{{ phrase('approve')|for_attr }}" />
                        <a href="{{ link('media/note-approve', $mediaItem, {'note_id': $note.note_id, 't': csrf_token()}) }}"
                            class="u-concealed">
                            {{ phrase('approve') }}
                        </a>
                    </li>
                    <li>
                        <xf:fa icon="fa-times" title="{{ phrase('reject')|for_attr }}" />
                        <a href="{{ link('media/note-reject', $mediaItem, {'note_id': $note.note_id, 't': csrf_token()}) }}"
                            class="u-concealed">
                            {{ phrase('reject') }}
                        </a>
                    </li>
                <xf:elseif is="$note.canEdit()" />
                    <li><xf:fa icon="fa-pencil" title="{{ phrase('edit')|for_attr }}" /> <a href="javascript:" class="u-concealed js-mediaNoteTooltipEdit">{{ phrase('edit') }}</a></li>
                </xf:if>
            </ul>
        </div>
    </div>
</xf:macro>
<xf:macro name="info_sidebar" arg-mediaItem="!" arg-row="{{ true }}">
    <xf:set var="$info">
        <xf:if is="$mediaItem.Category">
            <dl class="pairs pairs--justified">
                <dt>{{ phrase('xfmg_category') }}</dt>
                <dd><a href="{{ link('media/categories', $mediaItem.Category) }}">{$mediaItem.Category.title}</a></dd>
            </dl>
        </xf:if>
        <xf:if is="$mediaItem.Album">
            <dl class="pairs pairs--justified">
                <dt>{{ phrase('xfmg_album') }}</dt>
                <dd><a href="{{ link('media/albums', $mediaItem.Album) }}">{$mediaItem.Album.title}</a></dd>
            </dl>
        </xf:if>
        <dl class="pairs pairs--justified">
            <dt>{{ phrase('xfmg_added_by') }}</dt>
            <dd><xf:username user="{$mediaItem.User}" defaultname="{$mediaItem.username}" /></dd>
        </dl>
        <dl class="pairs pairs--justified">
            <dt>{{ phrase('xfmg_date_added') }}</dt>
            <dd><xf:date time="{$mediaItem.media_date}" /></dd>
        </dl>
        <dl class="pairs pairs--justified">
            <dt>{{ phrase('xfmg_view_count') }}</dt>
            <dd>{$mediaItem.view_count|number}</dd>
        </dl>
        <dl class="pairs pairs--justified">
            <dt>{{ phrase('xfmg_comment_count') }}</dt>
            <dd>{$mediaItem.comment_count|number}</dd>
        </dl>
        <dl class="pairs pairs--justified">
            <dt>{{ phrase('rating') }}</dt>
            <dd>
                <xf:macro template="rating_macros" name="stars_text"
                    arg-rating="{$mediaItem.rating_avg}"
                    arg-count="{$mediaItem.rating_count}"
                    arg-rowClass="ratingStarsRow--textBlock" />
            </dd>
        </dl>
        <xf:macro template="custom_fields_macros" name="custom_fields_view"
            arg-type="xfmgMediaFields"
            arg-group="below_info"
            arg-onlyInclude="{{ $mediaItem.category_id ? $mediaItem.Category.field_cache : $mediaItem.Album.field_cache }}"
            arg-set="{$mediaItem.custom_fields}"
            arg-valueClass="pairs pairs--justified" />
    </xf:set>
    <xf:if is="$row">
        <div class="block">
            <div class="block-container">
                <h3 class="block-minorHeader">{{ phrase('xfmg_media_information') }}</h3>
                <div class="block-body block-row">
                    {$info|raw}
                </div>
            </div>
        </div>
    <xf:else />
        {$info|raw}
    </xf:if>
</xf:macro>
<xf:macro name="extra_info_sidebar" arg-mediaItem="!" arg-row="{{ true }}">
    <xf:set var="$info">
        <xf:macro template="custom_fields_macros" name="custom_fields_view"
            arg-type="xfmgMediaFields"
            arg-group="extra_info_sidebar_block"
            arg-onlyInclude="{{ $mediaItem.category_id ? $mediaItem.Category.field_cache : $mediaItem.Album.field_cache }}"
            arg-set="{$mediaItem.custom_fields}"
            arg-valueClass="pairs pairs--justified" />
    </xf:set>
    <xf:if is="$row">
        <xf:if contentcheck="true">
            <div class="block">
                <div class="block-container">
                    <h3 class="block-minorHeader">{{ phrase('xfmg_extra_information') }}</h3>
                    <div class="block-body block-row">
                        <xf:contentcheck>
                            {$info|raw}
                        </xf:contentcheck>
                    </div>
                </div>
            </div>
        </xf:if>
    <xf:else />
        {$info|raw}
    </xf:if>
</xf:macro>
<xf:macro name="additional_sidebar" arg-mediaItem="!">
    <xf:if contentcheck="true">
        <xf:contentcheck>
            <xf:foreach loop="$mediaItem.getExtraFieldBlocks()" key="$fieldId" value="$definition">
                <xf:if is="$definition.hasValue({$mediaItem.custom_fields.{$fieldId}})">
                    <div class="block">
                        <div class="block-container">
                            <h3 class="block-minorHeader">{$definition.title}</h3>
                            <div class="block-body block-row">
                                <xf:macro template="custom_fields_macros" name="custom_field_value"
                                    arg-definition="{$definition}"
                                    arg-value="{$mediaItem.custom_fields.{$fieldId}}" />
                            </div>
                        </div>
                    </div>
                </xf:if>
            </xf:foreach>
        </xf:contentcheck>
    </xf:if>
</xf:macro>
<xf:macro name="exif_sidebar" arg-mediaItem="!" arg-row="{{ true }}">
    <xf:if is="$mediaItem.exif_data">
        <xf:set var="$info">
            <xf:if is="$mediaItem.exif.device">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.device') }}</dt>
                    <dd>
                        {$mediaItem.exif.device}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.aperture">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.aperture') }}</dt>
                    <dd>
                        {$mediaItem.exif.aperture}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.focal">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.focal') }}</dt>
                    <dd>
                        {$mediaItem.exif.focal}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.exposure">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.exposure') }}</dt>
                    <dd>
                        {$mediaItem.exif.exposure}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.iso">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.iso') }}</dt>
                    <dd>
                        {$mediaItem.exif.iso}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.flash">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.flash') }}</dt>
                    <dd>
                        {$mediaItem.exif.flash}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.FileName">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.filename') }}</dt>
                    <dd>
                        {$mediaItem.Attachment.Data.filename}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.file_size">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.file_size') }}</dt>
                    <dd>
                        {$mediaItem.exif.file_size}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.date_taken">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.date_taken') }}</dt>
                    <dd>
                        {$mediaItem.exif.date_taken}
                    </dd>
                </dl>
            </xf:if>
            <xf:if is="$mediaItem.exif.dimensions">
                <dl class="pairs pairs--justified">
                    <dt>{{ phrase('xfmg_exif.dimensions') }}</dt>
                    <dd>
                        {$mediaItem.exif.dimensions}
                    </dd>
                </dl>
            </xf:if>
        </xf:set>
        <xf:if is="$row">
            <xf:if contentcheck="true">
                <div class="block">
                    <div class="block-container">
                        <h3 class="block-minorHeader">{{ phrase('xfmg_image_metadata') }}</h3>
                        <div class="block-body block-row">
                            <xf:contentcheck>
                                {$info|raw}
                            </xf:contentcheck>
                        </div>
                    </div>
                </div>
            </xf:if>
        <xf:else />
            {$info|raw}
        </xf:if>
    </xf:if>
</xf:macro>
<xf:macro name="user_tags_sidebar" arg-mediaNotes="!">
    <xf:if contentcheck="true">
        <div class="block">
            <div class="block-container">
                <h3 class="block-minorHeader">{{ phrase('xfmg_tagged_in_this_image...') }}</h3>
                <div class="block-body">
                    <xf:contentcheck>
                        <xf:foreach loop="$mediaNotes" value="$note">
                            <xf:if is="$note.note_type == 'user_tag' AND $note.tag_state == 'approved'">
                                <li class="block-row">
                                    <div class="contentRow">
                                        <div class="contentRow-figure">
                                            <xf:avatar user="$note.TaggedUser" defaultname="{$note.username}" size="xs" />
                                        </div>
                                        <div class="contentRow-main contentRow-main--close">
                                            <xf:username user="$note.TaggedUser" defaultname="{$note.username}" rich="true" />
                                            <div class="contentRow-minor">
                                                <xf:usertitle user="$note.TaggedUser" />
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            </xf:if>
                        </xf:foreach>
                    </xf:contentcheck>
                </div>
            </div>
        </div>
    </xf:if>
</xf:macro>
<xf:macro name="share_sidebar" arg-mediaItem="!" arg-row="{{ true }}">
    <xf:if contentcheck="true">
        <div class="block">
            <div class="block-container">
                <xf:contentcheck>
                    <xf:if contentcheck="true">
                        <h3 class="block-minorHeader">{{ phrase('xfmg_share_this_media') }}</h3>
                        <div class="block-body block-row block-row--separated">
                            <xf:contentcheck>
                                <xf:macro template="share_page_macros" name="buttons"
                                    arg-iconic="{{ true }}" />
                            </xf:contentcheck>
                        </div>
                    </xf:if>
                    <xf:if contentcheck="true">
                        <div class="block-body block-row block-row--separated">
                            <xf:contentcheck>
                                <xf:if is="$mediaItem.media_type == 'image'">
                                    <xf:macro template="share_page_macros" name="share_clipboard_input"
                                        arg-label="{{ phrase('xfmg_copy_image_link') }}"
                                        arg-text="{{ link('canonical:media/full', $mediaItem) }}"
                                        arg-successText="{{ phrase('link_copied_to_clipboard') }}" />
                                    <xf:macro template="share_page_macros" name="share_clipboard_input"
                                        arg-label="{{ phrase('xfmg_copy_image_bb_code') }}"
                                        arg-text="[IMG width="{{ $mediaItem.Attachment.Data.width }}px" height="{{ $mediaItem.Attachment.Data.height }}px"]{{ link('canonical:media/full', $mediaItem) }}[/IMG]" />
                                <xf:elseif is="$mediaItem.media_type == 'embed'" />
                                    <xf:macro template="share_page_macros" name="share_clipboard_input"
                                        arg-label="{{ phrase('xfmg_copy_media_bb_code') }}"
                                        arg-text="{$mediaItem.media_tag}" />
                                </xf:if>
                                <xf:if is="$mediaItem.thumbnail_date">
                                    <xf:macro template="share_page_macros" name="share_clipboard_input"
                                        arg-label="{{ phrase('xfmg_copy_url_bb_code_with_thumbnail') }}"
                                        arg-text="[URL="{{ link('canonical:media', $mediaItem) }}"][IMG width="{{ $xf.options.xfmgThumbnailDimensions.width }}px" height="{{ $xf.options.xfmgThumbnailDimensions.height }}px"]{$mediaItem.getCurrentThumbnailUrl(true)}[/IMG][/URL]" />
                                </xf:if>
                                <xf:macro template="share_page_macros" name="share_clipboard_input"
                                    arg-label="{{ phrase('xfmg_copy_gallery_bb_code') }}"
                                    arg-text="[GALLERY=media, {$mediaItem.media_id}][/GALLERY]" />
                            </xf:contentcheck>
                        </div>
                    </xf:if>
                </xf:contentcheck>
            </div>
        </div>
    </xf:if>
</xf:macro>