Menu

image alt= has changed

Help
robbie66
2006-01-27
2013-04-25
  • robbie66

    robbie66 - 2006-01-27

    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

     
    • robbie66

      robbie66 - 2006-01-27

      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 

       
    • robbie66

      robbie66 - 2006-01-27

      still not working for some old movies...

      change above line to

      new line = $tag_s = strpos ($this-&gt;page[&quot;Title&quot;], &quot;&lt;a name=\&quot;poster\&quot;&quot;);

      That should do the trick :-)

       
    • lordacebuz

      lordacebuz - 2006-02-02

      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

       
    • robbie66

      robbie66 - 2006-02-03

      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-&gt;page[&quot;Title&quot;], &quot;&lt;a name=\&quot;poster\&quot;&quot;);

       
    • robbie66

      robbie66 - 2006-02-03

      ohh maybe you should replace the &quot; with real quotes

      maybe the forum that screwed up the line 

       
    • Andy Berkvam

      Andy Berkvam - 2006-03-05

      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-&gt;page[&quot;Title&quot;], &quot;&lt;a name=\&quot;poster\&quot;&quot;);

       
    • Andy Berkvam

      Andy Berkvam - 2006-03-05

      Or this?

          $tag_s = strpos ($this->page["Title"], "<a name=\"poster\"");

       
    • Anonymous

      Anonymous - 2006-07-10

      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! :)

       
    • devnull

      devnull - 2006-11-20

      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;
      }

       
    • Diego Torres

      Diego Torres - 2006-12-03

      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;
        }

       

Log in to post a comment.

MongoDB Logo MongoDB