Problem file in Variable

The place for "I can't figure out how to..." questions.

Problem file in Variable

Postby DanielRuiz » Thu Nov 07, 2013 10:01 pm

I pass the file name of a variable mp4 right through an error occurs like to know which is the correct method to pass the file names variables through the error is as follows
A PHP Error was encountered
Severity: Notice
Message: Undefined index: playtime_string
Filename: controllers/home.php
Line Number: 308


i have this code
when the path is absolute works properly thank you very much.

Code: Select all
public function validarsegundos($nombre_video){
          // Initialize getID3 engine
      $this->load->library('getid3');
         $getID3 = new getID3;
         getid3_lib::CopyTagsToComments($ThisFileInfo);
         $Segundos = $ThisFileInfo['playtime_string'];
         $Segundos =str_replace(':', '', $Segundos);
         echo ($Segundos."\n");
         if($Segundos > '10'){
            echo "Mayor a 10";
         } else {
            echo "Menor a 10";   
         }
         /*
         if you want to see ALL the output, uncomment this line:
         */
         //echo '<pre>'.htmlentities(print_r($ThisFileInfo, true)).'</pre>';
}
DanielRuiz
User
 
Posts: 2
Joined: Thu Nov 07, 2013 9:52 pm

Re: Problem file in Variable

Postby James Heinrich » Thu Nov 07, 2013 10:14 pm

You're not actually analyzing the file anywhere. You need to call
Code: Select all
$ThisFileInfo = $getID3->analyze($filename);
after $getid3 = new getID3;
James Heinrich
getID3() v1 developer
 
Posts: 1411
Joined: Fri May 04, 2001 4:00 pm
Location: Northern Ontario, Canada

Re: Problem file in Variable

Postby DanielRuiz » Thu Nov 07, 2013 10:42 pm

Sorry I miss in my code
i am erase for wrong and comments
Code: Select all
public function validarsegundos($nombre_video){
          // Initialize getID3 engine
      $this->load->library('getid3');
         $getID3 = new getID3;
         getid3_lib::CopyTagsToComments($ThisFileInfo);
         $ThisFileInfo = $getID3->analyze('../uploads/'.$nombre_video);
         getid3_lib::CopyTagsToComments($ThisFileInfo);
         $Segundos = $ThisFileInfo['playtime_string'];
         $Segundos =str_replace(':', '', $Segundos);
         echo ($Segundos."\n");
         if($Segundos > '10'){
            echo "Mayor a 10";
         } else {
            echo "Menor a 10";   
         }
         /*
         if you want to see ALL the output, uncomment this line:
         */
         //echo '<pre>'.htmlentities(print_r($ThisFileInfo, true)).'</pre>';
}
DanielRuiz
User
 
Posts: 2
Joined: Thu Nov 07, 2013 9:52 pm

Re: Problem file in Variable

Postby James Heinrich » Thu Nov 07, 2013 11:01 pm

Obviously the analysis is failing, either because your file is broken or because the file doesn't exist. You should check the contents of $ThisFileInfo['error'] and/or $ThisFileInfo['warning']. Easier still, just un-comment the last line, as it suggests, to view what output is there. I'm fairly certain it contains something in the ['error'] key telling you why it's failing, probably that the file is missing, or possibly corrupt.

And please don't double-post every time.
James Heinrich
getID3() v1 developer
 
Posts: 1411
Joined: Fri May 04, 2001 4:00 pm
Location: Northern Ontario, Canada


Return to Support 1.x

Who is online

Users browsing this forum: No registered users and 2 guests

cron