Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display image in Databricks notebook error

I am working on creating a databricks notebook template with company logo. Using the below code to display image is throwing error.

Code:

%md
<img src ='/test/image/MyImage.jpg'>

Error:

HTTP ERROR 403: Invalid or missing CSRF token

Please guide me.

like image 450
ITHelpGuy Avatar asked Jul 16 '26 00:07

ITHelpGuy


1 Answers

You either need to store image somewhere, and refer to it as a full URL, for example, you can refer your company site.

Another way is to upload file to the /FileStore directory on DBFS, and then you can refer to it using the /files/ URL, that is supported in both HTML and Markdown (see docs):

%md
![my_test_image](files/image.jpg)

You can upload image using databricks-cli, or via UI (if you have DBFS File Browser enabled). (Another option is the DBFS REST API, but it's cumbersome)

like image 57
Alex Ott Avatar answered Jul 22 '26 03:07

Alex Ott