2

I am trying to show images from imdb api image shall show in todo.poster , it works perfectly fine when i try to access it locally. but when i deploy my project on server, images does not load the first time , but if i open the same image in new tab once and then refresh my project url , image would show. I am pretty much frustrated trying to solve this issue

 <div ng-repeat="todo in todos">
            <a href="#show/{{todo.title}}" >
                <h2>{{todo.title}}</h2>
                </a>
                <br>
                <a href="#show/{{todo.title}}" >
                <img ng-src= {{todo.poster}} alt="Image Not Found">
                </a>
      </div>

 http://ia.media-imdb.com/images/M/MV5BMTk4ODk5MTMyNV5BMl5BanBnXkFtZTcwMDMyNTg0Ng@@._V1_SX300.jpg 

If if use inspect element of my browser i see this error

  Failed to load resource: the server responded with a status of 403 (Forbidden)
  • Can you give details on request headers for successful responses and 403 responses? – Andy Gaskell Mar 29 '15 at 20:21
  • Do you tried to use ng-src="todo.poster" without the '{{' and '}}'? – Joao Polo Mar 30 '15 at 12:32
  • Hi - It ended up to be that imdb was actually blocking the request to show their posters , they don't allow hotlinking which is why they blocked it –  Mar 30 '15 at 23:56

1 Answers1

1

It ended up to be that imdb was actually blocking the request to show their posters , they don't allow hotlinking which is why they blocked it.They are checking referer to block the request.

There can be multiple solutions to this if someone else runs into same issue, one can be to first download images on your server and then showing those from there, another one could be to use some other api like moviedb. please note images returned by rotten tomatoes's api are thumbnail size only so that wouldn't be helpful.

Alternatively if someone wants to use api which fetches data from imdb only , then can use it in conjuction with moviedb , e.g. get all information from imdb and then using movie id returned by imdb you can get poster image or other images from moviedb.