Ask Your Question
2

Display a PNG image file in a worksheet

asked 2012-05-12 10:08:10 -0500

TSchwenn gravatar image

updated 2012-05-12 10:28:32 -0500

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'

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2012-05-12 16:06:15 -0500

kcrisman gravatar image

updated 2015-05-08 16:09:56 -0500

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?

edit flag offensive delete link more

Comments

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

sageMathUser gravatar imagesageMathUser ( 2015-05-06 17:26:27 -0500 )edit

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

kcrisman gravatar imagekcrisman ( 2015-05-08 10:55:06 -0500 )edit

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: 2012-05-12 10:08:10 -0500

Seen: 1,165 times

Last updated: May 08 '15