The Movie Database Support

Hey i was wondering how to use the poster_path image file from the api? Please help!

3 replies (on page 1 of 1)

Jump to last post

Hi @olbu,

Take a read through the image documentation. If you have any specific questions let me know.

Hey, thanks for the answer! Could you help me with using this link but with a variable?

https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg

So i want to use the api and get that last "/kqjL17yufvn9OVLyXYpvtyrFfak.jpg" from poster_path api and then send it to my something like

"img src="https://image.tmdb.org/t/p/w500 + poster_pathVar"

I'm sorry if this is confusing as hell, I don't have my code atm so I tried to remember what I last wrote. Thanks!!

@olbu That sounds like a coding question. And it sounds like you need to find the part before the last forward slash and use that as your prefix.

E.g. To get prefix and suffix from the image URL in JS:

const url = "https://image.tmdb.org/t/p/w500/kqjL17yufvn9OVLyXYpvtyrFfak.jpg"
const prefix = url.substr(0, url.lastIndexOf('/') + 1)
const suffix = url.substr(url.lastIndexOf('/') + 1)

console.log(prefix)
console.log(suffix)

https://codepen.io/kJamesy/pen/zQPGOP

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login