cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lgekeler
Community Member

Retrieve direct URL for images- how?

This has been frustrating. I've tried URLs of the form:

https://canvas.nd.edu/courses/33333/file_content/Public/11111

and

https://canvas.nd.edu/api/v1/courses/33333/files/11111 

(which I could've sworn worked last week), but I can not find the URL construct (it's not the same as the 2017 post here I found) that works. Any help?

 

Context: A Theme designer (contract worker) created some custom icons for use in course sites/templates. They've been stored externally to Canvas. I want to store them internally, in a Public course and have the .css file/theme reference them.

0 Kudos
1 Reply
maguire
Community Champion

If the images have been included in a page you can see them as files. For example, here is the HTML for a figure in one of my courses (with the verifier replaced by xxxxx):

<figure><img src="https://kth.instructure.com/courses/17234/files/2642063/download?verifier=xxxxx" alt="ethernet_encapsulation.png" data-api-endpoint="https://kth.instructure.com/api/v1/courses/17234/files/2642063" data-api-returntype="File">
<figcaption>Ethernet encapsulation <span class="inline-ref">(see Stevens, Volume 1, Figure 2.1, pg. 23)</span></figcaption>
</figure>


I have a python script to list all files to a XLSX spreadsheet. This makes it easy to see the URL for a give image, it could be run on the above course with

./list-files.py 17234

It is available from:

https://github.com/gqmaguirejr/Canvas-tools

 

Tags (1)