MyBB Community Forums

Full Version: Permit display of uploaded images for selected users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
This seems like an obvious question that must already have an obvious answer, but this idiot hasn't been able to find it despite many searches! Blush

A forum user can upload images as attachments, and can Insert that attachment into their post. But the uploaded/attached image, it seems, can only be placed as a clickable link that opens a new browser tab to display the uploaded image. I cannot find a way to actually embed the uploaded image to display as a visible picture in the post itself.

Of course, images hosted ELSEWHERE can be embedded via their URL - but not images uploaded to the forum's own host?

I believe the normal reason why uploaded images aren't permitted to be directly displayed is to prevent bloat at the forum's server.
But what I'd prefer would be an option to permit selected trusted users to embed uploaded images directly in their posts. If there is such an admin setting, I haven't been able to locate it.

Alternatively, if I knew where uploaded images were stored in the forum database (I don't!), could that location be the URL for an embedded image?
You need to look in the ACP > Configuration > Posting options.

Show Attached Thumbnails in Posts
How do you want images to be shown in posts?

There you can choose if an image is shown as a thumbnail or link or full size image. If the latter, then watch out for huge images smashing layouts.
Thanks Lee!
This is essentially what I had been looking for....but it is a global setting, not on a user-specific or even a forum-specific basis.

You're absolutely correct that full-size images could trash the layout. But when you have a few selected, trusted users that you know will handle images in an appropriate manner, it would be nice to grant them the permission.
Well, you can also set if usergroups are allowed to upload attachments (all attachments, not just images).

Maybe that is a way round the problem. I must say, I would prefer it if file types in attachments could be assigned per group - like all users can attach a jpg (for example) only other groups can attach zip. That kind of thing.
This could be user specific by choosing what users can use the img MyCode like this.
Admin CP -> Configuration -> MyCodes -> new MyCode
Name: Image
Description: An image tag.
Regular Expression:
\[img-attach=(.*?)\]

HTML Replacement:
<img src="http://path_to_forum.com/attachment.php?aid=$1" />

Usage in MyCode:
[img-attach]

You can add permissions like what forums it can be used in and what groups can use it with Advanced MyCode Permissions.

But then Leefish's suggestion is a lot more simple.
Jordan, that's just beautiful.

You, Lee and so many others here are the reason why I love this open-source BB package.

I haven't had many questions over the years, but when I have, there've always been solutions! Big Grin

thanks!
Your welcome and thanks for the praise. Big Grin
Okay! I now have images uploaded via MyBB displaying correctly as embedded within posts!

BUT I just discovered they are visible to registered users only; if not logged-in one only sees a the linked name of the image, which takes you to the log-in panel.

I understand this is a protection for OTHER types of uploaded content, but is there a setting to enable direct visibility of uploaded images only, to ALL forum visitors? In other words, I'd still prefer that .zip, .pdf, .doc files and so on require registration to access.

I've looked through all the Admin options but cannot locate anything pertinent to this question...hope I've phrased this question clearly!
Yes, I will find you the link.

http://community.mybb.com/thread-128763.html

Do read the whole thread Big Grin - there are alternate code edits in there.
Thanks very much, Lee - yes, those code mods do permit access to the link in the post for an uploaded image: a user not logged-in can click on the link to see the image in a new browser tab. (one version EXCLUDES specified filetypes from access to unregistered users; the other excludes all filetypes NOT specified)

In EITHER case, the image uploaded to the forum is STILL not directly embedded in the post for viewing by any unlogged-in visitors. This makes it difficult (!) to discuss an image in the post AND view that image at the same time!

I'm surprised this isn't a more common request or need among admins; I guess it's such common practice that images must be uploaded to third-party servers and linked/embedded from the post that no one considers this important. And of course the URL/embed approach works just fine for most.

Not being a php coder, I'm unable to write anything custom to make this modification. At this point, I guess I'll just tell users to upload to third-party hosts from now on if they want their images seen by all visitors...

Thanks again!
Pages: 1 2