Php gd image: cannot be displayed because it contains errors

This error really annoys me:

If I comment

require_once'../class/myclass.class.php'; 

image is displayed. If I do not comment on my line calling myclass.class.php, I have this message:

"The image "http://..." cannot be displayed because it contains errors."

My code is simple:

myclass.class.php:

<?php    
class myclass {
  public function getPanelData( $model ){
    $aFieldsData = array(
      'PAN35'=>array(
        'col'=>1,
        'row'=>3,
        'v-font'=>10,
        'v-marge-top'=>0,
        'v-marge-right'=>1,
        'v-marge-bottom'=>0,
        'v-marge-left'=>1
      )
    );
    if( key_exists($model, $aFieldsData) )
      return $aFieldsData[$model];
    else
      return false;
    }
  }
?>

img.inc.php:

<?php
  session_start();
  require_once('myfunctions.inc.php');
  require_once('../class/myclass.class.php');
  $oData = new myclass();
  header('Content-Type: image/png');
  $sPanelModel = $_SESSION['produit'];
  $sEtiquette = '../img/etiquettes/label_'.$sPanelModel.'_preview.png';
  $rImg = imagecreatefrompng($sEtiquette);
  imagepng($rImg);
  imagedestroy($rImg);
?>

Note. This code works if I comment on require_once by calling myclass.class.php. Calling functions.inc.php works (just a few functions).

tree :
/
 + class
   + myclass.class.php
 + inc
   + functions.inc.php
   + img.inc.php
 + images
   + etiquettes
+3
source share
1 answer

, , require() myclass.class.php, () <?php ?>. Ascii php ( ) () , , . , , - , readfile() . , ,

+3

All Articles