developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #591: image.diff

File image.diff, 1.3 KB (added by Lipki, 13 years ago)
  • function.image.php

     
    3434 * sopacity :uint
    3535 * scolor #000000 :string
    3636 * background #000000 :string
     37 * notexists :boolean [true|false|alternate uri]
    3738 *
    3839 * gif   -> image/gif
    3940 * jpeg  -> image/jpeg
     
    6465        $params['background'] = '#ffffff';
    6566    }
    6667   
     68    // if not exists
     69    $origine_src = JELIX_APP_WWW_PATH.$src;
     70    if( empty($params['notexists']) ) $params['notexists'] = false;
     71    if( !is_file( $origine_src ) && $params['notexists'] &&  is_string ( $params['notexists'] ) )
     72        $src = $params['notexists'];
     73   
    6774    // Name of the file cache
    6875    $chaine = $src;
    6976    foreach($params as $key => $value)
     
    103110        $att['src'] = $cache_www;
    104111   
    105112    // Tag image
    106     echo '<img';
    107     foreach( $att as $key => $val )
    108         if( !empty($val) )
    109             echo ' '.$key.'="'.$val.'"';
    110     echo '/>';
     113    if( $params['notexists'] !== true || is_file( $origine_src ) ) {
     114        echo '<img';
     115        foreach( $att as $key => $val )
     116            if( !empty($val) )
     117                echo ' '.$key.'="'.$val.'"';
     118        echo '/>';
     119    }
    111120   
    112     }
     121}
    113122
    114123function jtpl_function_html_image_inCache($src, $cachename, $array) {
    115124