Ask Your Question
2

Display a PNG image file in a worksheet

asked 12 years ago

TSchwenn gravatar image

updated 12 years ago

I've uploaded an image file (DATA+'foo.png') into a notebook worksheet. How can I display it in the worksheet? I've tried using the statement

show(DATA+'foo.png')

but it just returns the file's path:

'/home/sage/.sage/sage_notebook.sagenb/home/admin/18/data/foo.png'

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 12 years ago

kcrisman gravatar image

updated 9 years ago

How do you want to show it? The command you gave is showing a string (DATA is a Python string), so that is why that doesn't work.

To just insert the image, use the TinyMCE GUI editor (shift-click on a blue "new cell" line). Full instructions were at Mike May's great worksheet, where you don't even need the DATA variable to use the image link; this is just doing the same thing.

This is what I think you mean - see these screen captures. Basically, you upload the file, and then in the TinyMCE editor you click on the picture icon and put just the name of the file in as your picture file name. Here I uploaded a picture of your question into my worksheet.

image description

image description

image description

image description

I imagine that you could also get it to show up by inserting some HTML into a cell with html() and using an <img> tag or something?

Preview: (hide)
link

Comments

Both, the link and the image do not work...

sageMathUser gravatar imagesageMathUser ( 9 years ago )

This is true, since sagenb public worksheets are down. I'm not sure why the image doesn't work.

kcrisman gravatar imagekcrisman ( 9 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 2,904 times

Last updated: May 08 '15