News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Question about inline attachments/pictures in a post

Started by flashsteam, February 06, 2010, 01:44:18 AM

Previous topic - Next topic

flashsteam

Hi,

Im a new admin running an SMF forum. Ive searched for awhile tonight looking for simple step by step instructions on how to post attachments inline in posts.

If anyone can provide a link, I sure would appreciate it.

This is a link to my forum, and the post I would like to have inline attachments for.

www 4cyclesteamengine.com/flashsteam_forum/index.php?topic=9.msg34

As you can see they will only display under the post, I would like to provide a short narrative describing each picture in the post.

I tried to use the insert picture button, but it wont provide a valid link to display the picture.

I found this Mod

www custom.simplemachines.org/mods/index.php?mod=1179

But I cant install it, since my forum is version: SMF 1.1.11

Am I going about this the wrong way? Ive searched the whole ADMIN control panel, but it just seems as if I cannot place inline pictures in posts.


best

Jeremy

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

aishaweb

Alternatively, you could use a free image hosting service such as photobucket, also doing it that way will save you some bandwidth and disc space.

flashsteam

Thanks for the welcome Kays.

I was able to successfully install the mod and it does work, thank you. I like the ease of being able insert the attachments into the post using the [attachment=1] link next to the listed attachments.

I noticed that the attachments under the post display aswell. I went to the attachment settings (in admin control panel) and unchecked the box that displays attachments under the post. When I did this, none of the images were open/visible, both inline in the post and under it.

Is there a way to make the images visible, only inline in the post, or have the images show as thumbnails under the post, while the inline images remain full size?

Aishaweb, I was considering something like that in order to use the insert inmage button. However, I have alot of server storage space and bandwidth. Ideally I would like to keep everything on the forums database. Thanks for the suggestion. 


best


Jeremy

Kays

Quote
Is there a way to make the images visible, only inline in the post, or have the images show as thumbnails under the post, while the inline images remain full size?

If you enable thumbnails then they should appear at the bottom of the post.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

When im in "Attachment settings" on the control panel.

"Display image attachments as pictures under post:"
"Resize images when showing under posts:"

If I check the box on the first option, the inline attachments will display in full size and so will the attachments under the post.

If I uncheck this option none of the pictures(the attachments) will display, both inline and under the post. Only the attachment links will show(in both places).

If I check the second box (if the first box is checked) the all the attachments will display in thumbnail size, again, both, with the inline images and under post images.

What I want, is for "only" the inline attachments to display, and the attachments under the post not too. If the links for the attachment remain that is fine. I feel it distracts from the post, if the attachments display in the post and under it. If the attachments are both to display I would preffer the under post attachments to be thumbnails and the inline posts be full size. I only suggest this because it is a secondary option that I would consider.

I would rather have the attachments display, only inline, in the post and not display attachments under it. Is there another Mod, that will give me the ability to do that? 

As it stands now, I can only see the inline attachments display, if the "Display image attachments as pictures under post:" is checked, so, I can only see both display or neither display. I want the inline attachments to display only.

best

Jeremy

Kays

Blah.. So it mirrors the image below.

In display.template.php of the theme you are using look for:

if ($attachment['is_image'])
{
if ($attachment['thumbnail']['has_thumb'])
echo '
<a href="', $attachment['href'], ';image" id="link_', $attachment['id'], '" onclick="', $attachment['thumbnail']['javascript'], '"><img src="', $attachment['thumbnail']['href'], '" alt="" id="thumb_', $attachment['id'], '" border="0" /></a><br />';
else
echo '
<img src="' . $attachment['href'] . ';image" alt="" width="' . $attachment['width'] . '" height="' . $attachment['height'] . '" border="0" /><br />';
}


and either comment it out or change to first line to:


if ($attachment['is_image'] && 1 != 1)



This should disappear the images and just leave the link.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

QuoteBlah.. So it mirrors the image below.

lol

QuoteThis should disappear the images and just leave the link.


That will be perfect, so this will only affect the "under post" attachments, just want to double check, before I start to messin around with the code.

best

Jeremy

Kays

I haven't test it but it should disappear just the images below the post.


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

I was able to find the code and change it, In "display.template.php". It was in the first set of code on that page. I changed-

if ($attachment['is_image'])

to

if ($attachment['is_image'] && 1 != 1)

Nothing changed, both inline and bottom of post attachments still displayed, same as before.

best

Jeremy

Kays

And you did that in the display.template.php in the theme you are using?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

Im going to double check now. Funny you mention that, the template name seemed unfamiar.

best

Jeremy

flashsteam

Im using-

SMF Default Theme - Core

When I click "Themes and Layout" on the admin control panel, the hit modify theme, SMF Default Theme - Core does show on the "modify themes" as a choice, there were 2 other themes that did show, (that came with the installation) but I deleted them, hoping the default would list as a choice. It did not, so I cant get to "display.template.php of the theme you are using"  for my current theme.

I was able to get to that, for the other theme (that I changed) and I deleted. Thru the modify themes, I just cant make it to "display.template.php" for my default theme. Since it does not show up as a choice to select, right now theres nothing there since I deleted the other themes im not using.

best

Jeremy

Kays

If there's no file in the theme you are using then SMF will use that file from the default theme.

It's a bit easier if you use a FTP client. Download the file from the default theme, edit it and then upload it to the theme you are using.

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

I think im stuck...

I can veiw the ftp files where I need to change the script, but cannot edit the page.

"Download the file from the default theme, edit it and then upload it to the theme you are using."

I never was taught how to do that, I guess its biting me in the ass now.

best

Jeremy

Kays

Not a problem.

If your host allows you to use an FTP client, it's a very useful tool to have when taking care of a site.

See if this helps get you started. How do I use FTP? / What is FTP?

If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

flashsteam

I was able to modify the script using my FTP client. It worked and im happy with the result, Thank-you very much Kays.

At first I tried to edit the script by just logging into my FTP server with IE, that didnt work, it would only allow me to veiw not edit.

This morning I checked the post here and followed the link on FTP. I have filezilla, so I opened the FTP site using that client. I then down loaded the "display template" file to a file on my computer, opened the file with notepad, was able to edit the script, then sent the file back thru filezilla, overwriting the "display template file" on the ftp server with the downloaded file that I edited.

It worked and im very happy with the result. Thanks again...

best

Jeremy

Kays


If at first you don't succeed, use a bigger hammer. If that fails, read the manual.
My Mods

Shivakumar L Narayan

Bumped into this when i was searching for posting images inline with the post. This one really helped and works like a charm.

Thanks a lot to Kays for it.

Cheers.

jcarnes

I'm sorry to revive a very old topic, but it certainly *almost* solved my needs. Is there a way to modify this so that if there is no image within the text, that the images will still display below as attachments?

Seems if I "insert" an image URL in the text (with , the image looks great in line with the text BUT the image also appears below the forum article. Making the modification above, solves that issue by only putting a link in the attachment area. Now, however, when NOT inserting an image into the text, just as an attachment, there is only a link to the attachment, no thumbnail or image.

That's what I am looking to fix - if an image in text, then no attachment image; if no image in text, then show and attachment image.

Thanks for any help for someone who knows nothing about programming. :)

Advertisement: