MyBB Community Forums

Full Version: Where do I edit the raw coding that the [attachment] bbcode sources from?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When I insert an attachment with [attachment-4] for example, if it's an image, it's still too wide for the screen with no way to manually resize the width with coding the way I would a normal HTML img link.

Where in MyBB do I go to edit the hard coding that tells the page what to do when it sees [attachment] bbcode?  Basically once I'm in there, I'm going to hunt down the condition for when it's an image extension and add a max-width command.

Where can I access the spot where that [attachment] coding is exposed?
I think it's get_post_attachments() inside ./inc/functions_post.php, and it then renders a template.

Although, wouldn't it be simpler to add some CSS to set a max width on images inside posts?
I was hoping to specifically have the max width only apply to the attachment supplied images for this particular case.  Thanks, I'll check that file out and give it a shot soon!

On Edit:  Or maybe I'm doing this the hard way.  Here's what I'm looking to accomplish:

On mobile, I want a full sized attachment image that's in a post to shrink (only when needed) in order to stay within the post without stretching it to the right.  My thought was adding some max-width and some width:100% type of styling to the images the attachment code supplies, so that when the screen gets small enough the image also starts to shrink to stay inside of the 100% width instead of staying too big. 

  I only want to do this for attachment images.  Is there an easier way I'm overlooking, or is my idea the best bet?
The relevant template might be postbit_attachments_images_image under "Post Bit Templates".
(2021-04-04, 08:21 PM)noyle Wrote: [ -> ]The relevant template might be postbit_attachments_images_image under "Post Bit Templates".


PERFECT!  Tested and 100% works as the solution I was looking for when I insert this into the img tag:   style="max-width:100%"