Forum:How to add images to a Biostars post
3
38
Entering edit mode
6.6 years ago
Ram 44k

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.


  1. Upload your image
  2. Add the image to your biostars post using one of the following methods:
    1. Markdown Method
    2. Inline HTML Method
how-to • 9.8k views
ADD COMMENT
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.

ADD REPLY
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.

ADD REPLY
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.

ADD REPLY
6
Entering edit mode
6.1 years ago
Ram 44k

Upload your image:

  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.

    Home Page

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

    Choose File

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

    Ready to Upload

  • 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.

    Viewer Link

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

    Viewer 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

    Copy Image Address

  • 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:

    Embed codes

  • 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.

    HTML Embed code

ADD COMMENT
2
Entering edit mode
6.1 years ago
Ram 44k

a. Markdown method to embed image

  • This uses the direct link obtained from above.

  • Click on the image option on the toolbar

    Initial post

    Image option

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

    Empty Pop-up

    Filled Pop-up

  • Your post should have the image as shown below

    Image added

ADD COMMENT
0
Entering edit mode

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

ADD REPLY
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?

ADD REPLY
2
Entering edit mode
6.1 years ago
Ram 44k

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

    Embed code added

  • 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

    Advanced Option

ADD COMMENT

Login before adding your answer.

Traffic: 2275 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6