Jump to content

id3 Help!


mattclements

Recommended Posts

Hello there,

My client uses the following code:

<?php
/*
  $Id: inlaudition.php,v 1.22 2003/06/05 23:26:23 hpdl Exp $
*/

require_once('includes/application_top.php');
$productid = $HTTP_GET_VARS['pid'];

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $productid . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

require_once 'local/exfunc.php';

?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script type="text/javascript" src="/catalog/local/jscript/browserdetect.js"></script>
<script type="text/javascript" src="/catalog/local/jscript/prototype.js"></script>
<script type="text/javascript" src="/catalog/local/jscript/exjs.js"></script>
<script type="text/javascript" src="/catalog/local/jscript/effects.js"></script>
<script type="text/javascript" src="/catalog/local/jscript/builder.js"></script>
<!--[if lte IE 6]>
<style type="text/css">
img{behaviour:url(/catalog/iepngfix.htc);}
</style>
<![endif]-->
<style type="text/css">
html{ background: transparent;}
body{ font-size:11px;font-family: Arial, Helvetica, Verdana, sans-serif;height:100%;margin:0;padding:0;background: transparent;}

.nameblock
{
  position:relative;  
  height:auto;
  padding:4px;
}

.modelblock
{
  position:relative;
  padding:4px;
}

.bottomblock
{
  position:relative;
  padding:4px;
}

.descrblock
{
  padding:12px 4px 12px 4px;
  position:relative;  
}

.id3block
{
  vertical-align:top;
  position:relative;
}

.lside
{
  font-size:11px;  
  color:#969696;
}
.rside
{
  color:#000000;
  font-size:11px;
  font-weight:bold;
}

.mp3name
{
  font-size:16px;
  color:#1e1e1e;
  font-weight:bold;
}

.mp3model
{
  padding-left:12px;
  color:#969696;
  font-weight:bold;
}
.mp3descr
{
  color:#969696;
  font-weight:bold;
}
.id3descr
{
  color:#969696;
  font-weight:bold;
}

</style>
</head>
<body>
<?php

$startDir = dirname( __FILE__ );
$filedir = $startDir.'/media/';

$pname = $product_info['products_name'];
$purl = $product_info['products_url'];
$pdesc = $product_info['products_description'];
$pmodel = $product_info['products_model'];
$pimage = $product_info['products_image'];

$pmanuid = $product_info['manufacturers_id'];

$manquery = tep_db_query("select manufacturers_name, manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = " . $pmanuid);
$man_info = tep_db_fetch_array($manquery);

$manname = $man_info['manufacturers_name'];
if ( empty($pimage))
{
  $pimage = $man_info['manufacturers_image'];
  
  if ( empty($pimage))
  {
    $pimage = "fronthtml.png";
  }
}

$pimage = DIR_WS_HTTP_CATALOG."images/".$pimage;

$pos = strpos($purl, '.wav' );
if ( $pos == false )
{
  $pos = strpos( $purl, '.flac' );
  if ( $pos == false )
  {
    $pos = strpos($purl, '.mp3' );
  }
}

$data = null;

if ( $pos !== false )
{
  $subname = substr($purl, 0, $pos );
  $output1 = namefromupload( $purl, '192k');

    $idd = new id3( $output1 );
  $data1 = $idd->getmp3data();
  $data2 = $idd->gettags();

  uksort($data2, 'sorttags' );
  
  $cols = 2;
  
  $i = 0;
  
  $str = '<table style="width:100%;">';
    
  $flip = 0;

  foreach( $data2 as $k => $d )
  {
    $longname = $d['longname'];

    if ( $flip == 0 )
    {
      if ( $i > 0 )
      {
        $str .= "</tr>\n"; 
      }
        
      $str .= "<tr>\n"; 
    }

    if ( $k{0} == 'T' )
    {
      $str .= '<td style="width:50%;">';
      
      $dstr = null;
      
      if( $k == 'TCON' )
      {
        $dstr = $d['genre']; 
      }
      else
      {
        $dstr = $d['text']; 
      }
      
      if ( $k == 'TSRC' )
      {
        $dstr = fixisrc($dstr); 
      }
      
      else if ($k == 'TDAT')
      {
        if ( strpos( $dstr, '-' ) !== false )
        {
          $rep = explode( '-', $dstr );
          if ( count( $rep ) == 3 )
          {
            $mon = $rep[1];
            $day = $rep[2];
            $dstr = "$day / $mon ";
          }
        }
        else
        {
          // 4 bytes with month and day
          //      ~~~~~~~~~~~~~~~~~~~~~~~~~~
          $day = $dstr{0}.$dstr{1};
          $mon = $dstr{2}.$dstr{3};
          $dstr = "$day / $mon"; 
        }
      }      

      $str .= "<table style=\"width:100%;\">
        <tr>
        <td style=\"width:40%;\">
        <span class=\"lside\">$longname:</span>
        </td>
        <td><span class=\"rside\">$dstr</span>
        </td>
        </tr>
        </table>"; 
    }
    else
    {
      switch( $k )
      {
        case 'APIC':
        {
          if ( $flip > 0 )
          {
            $str .= '</td></tr><tr>';
            $flip = 0;
          }
          
          $str .= '<td style="width:100%" colspan="2">';
          $flip++;
          
          $mime = $d['mime'];
          
          // $format = $d['format'];
          $imagebits = isset($d['bits'])? $d['bits']: null;
            
          // echo "See Image bits<br />";
          
          if ( isset($mime) && isset($imagebits))
          {
            $imsrc = createtemppic($imagebits);
            
            // echo "See $imsrc<br />";
            if ( $imsrc !== false )
            {
              $str .= "<div style=\"width:100%;\"><img src=\"$imsrc\" alt=\"\" /></div>"; 
            } 
          } 
          // die();
        }
          
        break;
        
        case 'COMM':
          $str .= '<td style="width:50%;">';          

          $dstr = $d['text'];
            
          $str .= "<table style=\"width:100%;\">
        <tr>
        <td style=\"width:40%;\">
        <span class=\"lside\">$longname:</span>
        </td>
        <td><span class=\"rside\">$dstr</span>
        </td>
        </tr>
        </table>";
          break;
          
        default:
          $str .= '<td style="width:50%;">';
          break;   
      } 
    }

    $str .= '</td>';
    
    if ( ++$flip == $cols )
    {
      $flip = 0;
    }

    $i++; 
  }

  foreach( $data1 as $k => $d )
  {
    if ( $flip == 0 )
    {
      if ( $i > 0 )
      {
        $str .= "</tr>\n";        
      }

      $str .= "<tr>\n"; 
    }    

    $str .= '<td style="width:50%;">';
    
    $extra = $k == 'time'? ' seconds': null;
    
    $str .= "<table style=\"width:100%;\">
        <tr>
        <td style=\"width:40%;\">
        <span class=\"lside\">$k:</span>
        </td>
        <td><span class=\"rside\">$d{$extra}</span>
        </td>
        </tr>
        </table>";
    

    $str .= '</td>';
    
    
    if ( ++$flip == $cols )
    {
      
      $flip = 0; 
    }

    $i++; 
  }  

  $str .= '</table>';    
}

?>

<div style="height:98%;width:100%;overflow:auto;">

<div style="width:100%;">

<div class="nameblock">
<span class="mp3name"><?php echo $pname;?></span><span class="mp3model">[<?php echo $pmodel;?>]</span>
</div>

<div class="descrblock">
<span class="mp3descr"><?php echo $pdesc;?></span>
</div>

<div class="id3block">
<?php echo $str;?>
</div>

</div>
</div>

<?php
$cnt = count( $javascript );
$loadcnt = count( $onload );

if ( $cnt > 0 || $loadcnt > 0 )
{
  $str = "<script type=\"text/javascript\">\n//<![CDATA[\n";
  
  foreach ( $javascript as $jss )
  {
    $str .= $jss;
  }

  if ( $loadcnt > 0 )
  {
    $str .= "Event.onReady(function(){\n";
    foreach( $onload as $ld )
    {
      $str .= $ld;
    }
      
    $str .= "});\n";
  }
    
  $str .= "//]]>\n</script>\n";

  echo $str;
}
?>

</body>
</html>

 

Basically I am very confused - it works here: http://www.speciesaudio.com/catalog/inlinfo.php?&pid=35

and not on the new site: http://audio.ecoptimist.com/catalog/inlinfo.php?&pid=35

 

The site is 100% the same. I really cant work out what is different.

 

Thanks in advance!

Matt

Link to comment
https://forums.phpfreaks.com/topic/111385-id3-help/
Share on other sites

http://audio.ecoptimist.com/getid3/getid3.php has "class getID3"

 

But i have changes the "new id3" to "new getid3" to fix it and i now get:

"Fatal error: Call to undefined method getID3::getmp3data() in /content/audio.ecoptimist.com/catalog/inlinfo.php on line 153"

 

 

???

Link to comment
https://forums.phpfreaks.com/topic/111385-id3-help/#findComment-571804
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.