Forum:How to add images to a Biostars post
3
37
Entering edit mode
4.1 years ago
Ram 36k

## Summary

• You can add an uploaded image to your biostars post. The image should be accessible to the public via a straightforward URL. **Do not use Google Drive/DropBox/any website that requires log-in**
• Method 1: Upload the image, get the image direct URL (should end with an image file extension such as .jpeg or .png, and when you open the link in a browser, it should show only the image) and use with the image option on the biostars toolbar
• Method 2: Upload the image, get the embed HTML code and use it as part of the post text.

### UPDATE

I have removed the cubeupload method, as imgbb universally works for everyone.

### UPDATE - 2

The direct URL must end in .png or .jpg or a similar image file extension.

If the image direct URL you're using looks like this, you're doing it **wrong**: https://ibb.co/aBcDeF - see how it doesn't end in a .jpg or a .png or a similar image file extension?

## (Ridiculously) Detailed description follows

Here are two ways you can add an image to your post - using Markdown syntax, and with inline HTML. Markdown syntax looks better, while Inline HTML gives you more control and is easier. I'll demonstrate both methods here, and you can pick the one most appropriate to you.

2. Add the image to your biostars post using one of the following methods:
1. Markdown Method
2. Inline HTML Method
how-to Page • 7.1k views
1
Entering edit mode

A suggestion: Adding a function in the web that can identify whether an url link inserting has a figure basename (like png) during inserting a figure will effectively solve the issue. In most cases failed, people uploaded an HTML link, which needs to be opened to get the real figure link. Thank you.

0
Entering edit mode

Thank you for the suggestion. If you could check out the https://github.com/ialbert/biostar-central repository and suggest the code changes to be made to add your validation code in, that'd be great. I also think this might require forking and making changes to the underlying markdown engine.

1
Entering edit mode

I'm not familiar with python. It's a shame. However, I filed an issue at github and gave a simple solution that more tips during the poped inserting figure page. Thank you.

6
Entering edit mode
3.5 years ago
Ram 36k

1. Pick a free image upload site. I'd recommend imgbb as it is accessible in most countries, including Iran. NOTE: Please do not use imggmi or other hosts with DDoS protection. These sites do not load images immediately; instead they make you wait a few seconds before leading the image. This translates to images not displaying here on biostars unless users take a bunch of extra steps to view them.
2. Upload your image on the site. For demonstration purposes, I'm going to be using a random PCA plot image I found online. I've named the downloaded image file pca_image.png. Here's how to upload an image file on a couple of sites:

On imgbb:

• Click on the Start Uploading button on the home page.

• Navigate to your image file in the dialog that pops up. Select your file and click Open

• You should now see this upload screen. Click the Upload button.

• You should now see this success message. Copy the link under Viewer Links (highlighted in pink) and open it in a new tab or window.

• You should now be in the viewer window. Note the About and Embed Codes tabs in the lower left hand corner of the page.

• Right click on the image and click on Copy Image Address. This is the direct link to the image. It should look something like this: https://image.ibb.co/eMZArc/pca_image.png

• Click on the Embed Codes tab in the lower left hand side of the page. That should open up a set of links that looks like this:

• Copy the highlighted HTML text under the Full Image (linked) section using the Copy hover option availabe when you click in the text box. This is the embed code for the image.

2
Entering edit mode
3.5 years ago
Ram 36k

#### a. Markdown method to embed image

• This uses the direct link obtained from above.

• Click on the image option on the toolbar

• Paste the copied URL in the dialog box. Click OK

• Your post should have the image as shown below

0
Entering edit mode

Some situations this method not working. HTML method working best.

0
Entering edit mode

Can you give me an example? Did you use a different website instead of Imgbb, perhaps something with a DDOS protector?

2
Entering edit mode
3.5 years ago
Ram 36k

#### b. Inline HTML method to embed image:

• This uses the HTML embed code obtained from above

• Paste the HTML embed code as part of the text in your post to add the image directly, as shown below

• Advanced topic: You can also modify the embed code and add more attributes to control size, alt-text, etc. See this resource on HTML image tag to know how you can tweak your image. For example, I've adjusted the image width to 200 pixels here