• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Attachments Displayed

MattW

Well-known member
#1
I've noticed on my forum (and test forum) that when someone attaches an image, and doesn't insert it into the thread, it's always displaying the same size. This is also the same for attached files, which you can't insert into threads.

For example, on here attaching a PDF file
xenforo_attach.png

On my test site
z22se_test_pdf.png

and an image on my main site
z22se_attach_img.png

The size of the attached details doesn't match the settings I've got for thumbnails

settings.png

These are set the same on both forum installs. Any ideas why they look like they do?

Thanks,
Matt
 

Jake Bunce

XenForo moderator
Staff member
#2
Yeah that's weird. I noticed that on another forum recently. The style sheet actually divides that number in half to determine the size. I don't know why.

I had to edit this template:

Admin CP -> Appearance -> Templates -> EXTRA.css

Add this code:

Code:
.attachment .thumbnail
{
	width: {$xenOptions.attachmentThumbnailDimensions}px !important;
	height: {$xenOptions.attachmentThumbnailDimensions}px !important;
}

.attachment .thumbnail .SquareThumb
{
	width: {$xenOptions.attachmentThumbnailDimensions}px !important;
	height: {$xenOptions.attachmentThumbnailDimensions}px !important;
}
And I had to modify this template as well:

Admin CP -> Appearance -> Templates -> attached_files

Remove the red piece:

Code:
<xen:require css="attached_files.css" />

<div class="attachedFiles">
	<h4 class="attachedFilesHeader">{xen:phrase attached_files}:</h4>
	<ul class="attachmentList SquareThumbs"
		data-thumb-height="{xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 2'}"
		data-thumb-selector="div.thumbnail > a">
		<xen:foreach loop="$post.attachments" value="$attachment">
			<li class="attachment{xen:if {$attachment.thumbnailUrl}, ' image'}" title="{$attachment.filename}">
				<div class="boxModelFixer primaryContent">
					
					<div class="thumbnail">
						<xen:if is="{$attachment.thumbnailUrl} AND {$canViewAttachments}">
							<a href="{xen:link attachments, $attachment}" target="_blank" class="LbTrigger"
								data-href="{xen:link misc/lightbox}"><img 
								src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" class="LbImage" /></a>
						<xen:elseif is="{$attachment.thumbnailUrl}" />
							<a href="{xen:link attachments, $attachment}" target="_blank"><img
								src="{$attachment.thumbnailUrl}" alt="{$attachment.filename}" /></a>
						<xen:else />
							<a href="{xen:link attachments, $attachment}" target="_blank" class="genericAttachment"></a>
						</xen:if>
					</div>
					
					<div class="attachmentInfo pairsJustified">
						<h6 class="filename"><a href="{xen:link attachments, $attachment}" target="_blank">{$attachment.filename}</a></h6>
						<dl><dt>{xen:phrase file_size}:</dt> <dd>{xen:number $attachment.file_size, size}</dd></dl>
						<dl><dt>{xen:phrase views}:</dt> <dd>{xen:number $attachment.view_count}</dd></dl>
					</div>
				</div>
			</li>
		</xen:foreach>
	</ul>
</div>

<xen:comment><xen:require css="xenforo.css" /></xen:comment>
 

MattW

Well-known member
#3
That only works if I then set the thumbnail size back down to 100. We want it at 600 as people insert the thumbnails of images into posts. If I do the above, because we have the thumbnail set at 600, it makes the attached box 600 pixels high.
 

MattW

Well-known member
#4
Hmm, I've reverted both those template files back now on my test site, and it's only letting me upload 1 image, or sometimes none at all :confused:

error.PNG
 

MattW

Well-known member
#5
Ignore the above. That looks to have been related to the .htaccess I had in place for the test forum to make it password protected. Removed that, and can now upload again.

So, been able to fig the attachments based on Jake's information.

This is what I've done. I have my attached thumbnail set to 600 pixels. I want this to be reduced to 100 if it's not inserted into the thread inline.

Admin CP -> Appearance -> Templates -> attached_files
Code:
<div class="attachedFiles">
    <h4 class="attachedFilesHeader">{xen:phrase attached_files}:</h4>
    <ul class="attachmentList SquareThumbs"
        data-thumb-height="{xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 6'}"
        data-thumb-selector="div.thumbnail > a">
        <xen:foreach loop="$post.attachments" value="$attachment">
Admin CP -> Appearance -> Templates -> EXTRA.css
Code:
.attachment .thumbnail
{
    width: {xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 6'}px !important;
    height: {xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 6'}px !important;
}
 
.attachment .thumbnail .SquareThumb
{
    width: {xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 6'}px !important;
    height: {xen:calc '{$xenOptions.attachmentThumbnailDimensions} / 6'}px !important;
}

Fixed.PNG

and you can still insert them inline at 600 pixels

Fixed2.PNG