i some images link from imdb(using api 3rd party) and i load it to my sql db and then php app.. but when i click to show all covers they doesent appear :/ why? i use http://www.omdbapi.com/ api
this is my website, to run click on "Ver Lista de Filmes Capas" http://web.ist.utl.pt/ist170438/aux/mymdb.php
<?php
try
{
$host = "xxxx";
$user ="xxxx8";
$password = "xxx";
$dbname = $user;
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT * FROM Filme;";
$result = $db->query($sql);
$i = 0;
$per_row = 3;
echo '<table><tr>';
foreach ($result as $row)
{
echo '<td><img src="'.$row['imageLink'].'" width="200" height="200" /></td>';
if(++$i % $per_row == 0 && $i > 0 && $i < $count) {
# Close the row
echo '</tr><tr>';
}
}
for($x = 0; $x < $per_row - $i % $per_row; $x++) {
echo '<td></td>';
}
echo '</tr></table>';
/*
echo("<table border=\"5\" cellspacing=\"5\">\n");
$per_row = 6;
foreach($result as $row)
{
echo '<td><img src="'.$row['imageLink'].'" width="100" height="100" /></td>';
# If three cells have been printed, and we're not at the last image
if(++$i % $per_row == 0 && $i > 0 && $i < $count) {
# Close the row
echo '</tr><tr>';
}
# If the last row isn't 'full', fill it with empty cells
for($x = 0; $x < $per_row - $i % $per_row; $x++) {
echo '<td></td>';
}
echo '</tr></table>';*/
$db = null;
}
catch (PDOException $e)
{
echo("<p>ERROR: {$e->getMessage()}</p>");
}
?>
public void descobreInfoFilme(String nomeFilme, String nomePasta){
try{
String urls = KEY_BDAUX + nomeFilme;
double classificacao = 0;
String sinopse = null;
String urlImagem = null;
String imdbl = "http://www.imdb.com/title/";
String id= null;
int ano = 0;
LinkedList<String> listaGeneros = new LinkedList<String>();
URL url = new URL(urls);
InputStream is = url.openStream();
JsonReader rdr = Json.createReader(is);
JsonObject obj = rdr.readObject();
Filme f = getFilme(nomePasta);
urlImagem = obj.getString("Poster");
id = obj.getString("imdbID");
sinopse = obj.getString("Plot");
ano = Integer.parseInt(obj.getString("Year"));
listaGeneros.add(obj.getString("Genre"));
f.setLinkImdb(imdbl + id);
f.setLinkImagem(urlImagem);
f.setGenero(listaGeneros);
f.setSinopse(sinopse);
f.setAno(ano);
f.setClassificacao(classificacao);
listaGeneros = null;
}catch(Exception e){
System.out.println("ERRO AO DESCOBRIR informacoes DO IMDB DO FILME " + nomePasta);
System.out.println("ERRO AO DESCOBRIR informacoes DO IMDB DO FILME " + nomeFilme);
_listaFilmesErrados.add(nomePasta);
e.printStackTrace();
}
}
You are directly linking to IMDB images. There is most likely a hotlink protection that prevents you from doing it.
You should host the images yourself and not use bandwidth from other sites.