besides the last photo() function change, another change has to be made, because now Content-Type of photos return also the charset, so new savephoto is pasted here:
function savephoto ($path) {
$req = new IMDB_Request("");
$photo_url = $this->photo();
if (!$photo_url) return FALSE;
$req->setURL($photo_url);
$req->sendRequest();
if ( (strpos($req->getResponseHeader("Content-Type"), 'image/jpeg') !== FALSE) ||
(strpos($req->getResponseHeader("Content-Type"), 'image/gif') !== FALSE) ){
$fp = $req->getResponseBody();
}else{
echo "<BR>*photoerror* ".$photo_url."<BR>";
return false;
}
Since yesterday it seems that images are no longer parsed in the right way due to a change in the source of imdb.
<img border=\"0\" alt=\"cover\"
is now
<img border=\"0\" alt=\"title of the movie\"
Can someone verify this plz ?
thnx
Ok fixed it for the time being...
To fix the picture parsing change one line in the function photo () in imdb.class.php
old line = $tag_s = strpos ($this->page["Title"], "<img border=\"0\" alt=\"cover\"");
new line = $tag_s = strpos ($this->page["Title"], "<a name=\"poster\" href=\"photogallery\"");
That should fix it untill they (imdb peeps) change that line in their src again.
Thanx for this great script
still not working for some old movies...
change above line to
new line = $tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");
That should do the trick :-)
Changed the $tag_s line, and the image is still failing for me on some movies. Here are a few examples:
Entrapment
Das Boot
Dogma
In the Army Now
The Dirty Dozen
Hellboy
There are a bunch more, let me know if you want a bigger list.
Thanks
Hi lordacebuz
Well strange cause all these movies work for me, so there must be something wrong
You should take this line and it should work
$tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");
ohh maybe you should replace the " with real quotes
maybe the forum that screwed up the line
The gt and lt have to be replaced as well as the quot. Let's see if this shows up better:
$tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");
Or this?
$tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");
Hi there folks, here's what I did:
$yarg = ($this->title());
$tag_s = strpos ($this->page["Title"], "<img border=\"0\" alt=\"$yarg\"");
Works fine for me too! :)
now, it work's anymore... sometimes, instead of the poster, only a "IMDb TV"-picture is saved.
with this function, it works at my side:
function photo () {
if ($this->page["Title"] == "") $this->openpage ("Title");
$tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");
if ($tag_s == 0) return FALSE;
$pos_a = substr($this->page["Title"],$tag_s);
$tag_s = strpos ($pos_a, "src=\"");
$pos_b = substr($pos_a,$tag_s+5);
$tag_e = strpos ($pos_b, "\"");
$this->main_photo = substr ($pos_b, 0, $tag_e);
return $this->main_photo;
}
besides the last photo() function change, another change has to be made, because now Content-Type of photos return also the charset, so new savephoto is pasted here:
function savephoto ($path) {
$req = new IMDB_Request("");
$photo_url = $this->photo();
if (!$photo_url) return FALSE;
$req->setURL($photo_url);
$req->sendRequest();
if ( (strpos($req->getResponseHeader("Content-Type"), 'image/jpeg') !== FALSE) ||
(strpos($req->getResponseHeader("Content-Type"), 'image/gif') !== FALSE) ){
$fp = $req->getResponseBody();
}else{
echo "<BR>*photoerror* ".$photo_url."<BR>";
return false;
}
$fp2 = fopen ($path, "w");
if ((!$fp) || (!$fp2)){
echo "image error...<BR>";
return false;
}
fputs ($fp2, $fp);
return TRUE;
}