Image Upload Plugin for Forums and Websites

Add an image upload button to any forum or website with one script tag. Members press Upload image, pick or paste a picture, and the BBCode, HTML or Markdown code goes into their post at the cursor. There is no plugin to install, members need no account, and it is free.

The script is 4.8 KB over the wire and the button text comes in 16 languages.

How to add an image upload button to your forum

Paste this line into the template that loads on every page of your forum or website:

<script async src="https://myimgs.org/widget.js" data-format="bbcode"></script>
  1. Paste the line into your page template, just before the closing body tag or inside the head. The next section shows where that is in phpBB, XenForo and Discourse.
  2. Reload a page with a reply box. An Upload image button appears next to every post box.
  3. Set data-format to the code your forum uses: bbcode, html or markdown. Leave it out and the window remembers the last format each member used.

That is the whole installation. The script finds the post boxes by itself, skips search, login and other short fields, and picks up reply boxes that a forum opens later.

Your forum stores nothing. The pictures are hosted on myimgs.org, so they use none of your disk space or bandwidth, and the attachment limits of your forum do not apply to them.

This is what a member's upload becomes in each format. Every code shows the picture and links it to myimgs.org, and the address below is an example:

BBCode:   [url=https://myimgs.org/][img]https://myimgs.org/storage/images/123/photo.jpg[/img][/url]
HTML:     <a href="https://myimgs.org/"><img src="https://myimgs.org/storage/images/123/photo.jpg" alt="photo" /></a>
Markdown: [![photo](https://myimgs.org/storage/images/123/photo.jpg)](https://myimgs.org/)

Where to paste the script in phpBB, XenForo and Discourse

Each forum has one template that is printed on every page. Put the line there once and every page gets the button.

phpBB

Open the Administration Control Panel, go to Customise, then Templates under Style components (older versions call the tab Styles). Choose your style, open overall_footer.html and add the line just before </body>. Save, and refresh the board cache if phpBB asks you to. phpBB posts BBCode, so use data-format="bbcode".

<script async src="https://myimgs.org/widget.js" data-format="bbcode"></script>

Installing a new version of a style can overwrite template edits. Add the line again after a style update.

XenForo

In the admin control panel open Appearance, then Templates, and edit page_container_js_body (or PAGE_CONTAINER and add the line before the closing body tag). XenForo's default editor is a visual editor, so ask for HTML with data-format="html", then try one upload in the editor on your own forum.

<script async src="https://myimgs.org/widget.js" data-format="html"></script>

Discourse

Go to Admin, then Customize (Appearance in newer versions), then Themes. Pick your theme, choose Edit CSS/HTML, open the Head tab and paste the line as a plain script tag. Reload the forum page, because head changes need a refresh. Discourse posts Markdown, so use data-format="markdown". The reply box is created when someone starts a reply, and the script adds its button when the box appears.

<script async src="https://myimgs.org/widget.js" data-format="markdown"></script>

MyBB, SMF, vBulletin, Invision and other forum software

Edit your theme's footer or header template, the one printed on every page, and paste the line there. It works wherever the forum shows a plain text box or an editable area for writing posts. For a custom website, paste the line into your layout and, if you want one specific box, add data-target="#your-textarea".

What members see when they upload

  1. They press Upload image next to the post box.
  2. A small myimgs.org window opens. They choose images, drop them in, or paste a screenshot with Ctrl+V. They can send several at once.
  3. They pick the code: forum BBCode, website HTML, Markdown, a thumbnail version, or a plain link.
  4. They press Insert into post. The window closes and the code is in the post box at the cursor, on its own line.

If the page cannot take the code, the window stays open and shows it with a Copy button, so the upload is never lost.

Image upload plugin options

Set these as attributes on the script tag.

AttributeWhat it does
data-formatbbcode, html or markdown: the code that is inserted. Without it, the format the member used last (BBCode the first time).
data-targetA CSS selector such as #message. Only those boxes get a button.
data-labelThe button text. By default it is "Upload image" in the member's language.
data-langThe language of the upload window. By default the language of your page.
data-positionafter (default) or before the post box.
data-class, data-style="none"Add your own CSS classes, or turn the default button style off. The button has the class myimgs-upload-btn.
data-auto="off"Do not look for post boxes. Use your own button instead.

Your own button works anywhere. Any element with data-myimgs-upload and a selector opens the upload window for that box:

<button type="button" data-myimgs-upload="#post-body">Upload image</button>

Does it work with rich text editors?

It works with plain text boxes and with editable areas on the page itself. Some editors draw their text inside a frame of their own (certain WordPress, TinyMCE and CKEditor setups). The script cannot write into a frame, so it does not fill those automatically. Point your own button at a plain box on the same form, or switch the editor to its source view.

Pick the format your editor expects. BBCode forums take bbcode, Markdown forums take markdown, and visual editors that store HTML take html. In an editable area, HTML is inserted as HTML and BBCode or Markdown as text.

Do members need an account to upload?

No. A visitor who is not signed in can upload 10 images in one browser session, 10 MB per image. When the limit is reached the window keeps the images that are waiting and asks them to log in or register to myimgs to upload more. They do that in another tab, and the waiting images upload by themselves as soon as they are signed in.

A member who is signed in to myimgs in the same browser uploads into their own account, with the account's limits and the images listed under My images. A free account holds 20 images. The Pro plans for image hosting raise the limits and remove the ads for the account owner.

How big can the images be and how long do they stay?

Who uploadsPer imageHow many
Visitor who is not signed in10 MB10 images per browser session
Free account32 MB20 images, 100 MB of storage
Pro account96 MBUnlimited images

Accepted formats are JPG, PNG, GIF and WebP. Images in an account stay online until the owner deletes them. An image uploaded without an account that nobody ever opens is removed after 14 days. One that is opened but is not shown on a page we can see is removed after 60 days without a single view. An image that is shown on a page stays online. For a single image there is also the BBcode image generator.

Image upload button not showing? Fixes

  • Page cache or CDN. Clear the forum cache and the CDN cache after you edit the template. Pages cached before the edit do not have the script.
  • Wrong template. Some pages (the quick reply, a pop-up editor) use a different template. Put the line in the template that is printed on all of them, or in the footer.
  • The post box is hidden. If the editor hides the real text box and shows its own frame, no button is added. Use data-target with the selector of a visible box, or your own button.
  • A short or hidden field. The script skips boxes narrower than 200 pixels or shorter than 40 pixels, read-only fields, and fields named like search, login, captcha or password.
  • Content Security Policy. If your forum sends one, allow the script. See the next section.
  • The window is blocked. The window opens when a member presses the button, which browsers allow. A pop-up blocker set to block everything can still stop it. Allow pop-ups for your forum.
  • Mixed content. On an https forum the script address must be https, as in the line above.

Still stuck? Tell us the forum software and its version at support@myimgs.org.

Content Security Policy settings for the upload button

If your forum or website sends a Content-Security-Policy header, add the script host to script-src:

script-src 'self' https://myimgs.org;

Nothing else is needed for the upload window, because it is a separate window and not a frame. The button adds one small style tag. If style-src blocks inline styles, the button shows unstyled: add data-style="none" and style the .myimgs-upload-btn class in your own stylesheet. A policy of Cross-Origin-Opener-Policy: same-origin cuts the link between the forum page and the upload window. Insert then cannot reach the post, and the window shows the code with a Copy button.

Postimages forum mod vs Chevereto upload plugin vs MyIMGs

Postimages forum modChevereto upload pluginMyIMGs
What you addA script file for your forum engine, with options in the file nameOne script tagOne script tag
Forum software namedphpBB, SMF, MyBB, FluxBB, PunBB, ZetaBoardsbbPress, Discourse, Discuz!, Invision, MyBB, NodeBB, phpBB, SMF, Vanilla, vBulletin, XenForo, and any site with editable contentAny forum or website with a plain text box or editable area
Where images are hostedPostimagesA Chevereto site that you run or useMyIMGs, included
Rich editorsText boxesButton placed in the toolbar of the named forum editorsPlain boxes and editable areas, your own button for others
For members without admin helpNot described on its pagesNot described on its pagesBookmarklet, below
Install steps in textScreenshots for SMFOne example snippetThis page

Taken from each project's public pages when this page was written. Check their pages for current details.

Upload to any forum without installing anything

Members can add the upload window to any forum themselves, with no help from the admin. Drag this link to the bookmarks bar. On a forum, select the post box, press the bookmark, and upload. The code lands in the box you selected.

Upload to myimgs

A few sites block bookmarklets. If yours does, the upload window still opens and shows the code to copy.

Try the upload button on this page

The box below has the button, added by the same script line shown above.

Frequently asked questions

Is the image upload button free?

Yes. The script is free to add to your forum or website, and anyone can upload images for free. A free account holds 20 images. The Pro plans raise the limits.

Do members need an account to upload images?

No. A visitor who is not signed in can upload 10 images in one browser session. After that the upload window asks them to log in or register to upload more.

Which forum software does the upload button work with?

It works with any forum or website that shows a plain text box, or an editable area, for writing posts. The steps above cover phpBB, XenForo and Discourse. An editor that draws its own frame needs your own button, which takes one line (see the section on rich text editors).

Can I change the button text, language and style?

Yes. Use data-label for the text, data-lang for the language of the upload window, and data-style="none" plus your own CSS on the myimgs-upload-btn class for the look. The button text follows your page language in 16 languages by default.

Does the upload script slow down my forum?

The script is 4.8 KB over the wire (gzip) and loads without blocking the page. It adds one button per post box, and the upload window opens only when a member presses the button.

What does the upload script read from my pages?

Nothing. It looks for post boxes and writes the code the member chose into one of them. The upload happens in a window on myimgs.org, and the text of your posts is never sent to us. When the window opens we count the opening, with your site's host name, and nothing else.

How do I remove the image upload button?

Delete the script line from your template. The button is gone on the next page load. Images that were already uploaded stay online and keep working in old posts.

Need to post an image in a thread without any button? Read how to post images in forums using BBCode and HTML.