Exemplo n.º 1
0
 public static function import_file($file, $localpath = null)
 {
     if (in_array($file, self::instance()->_imp)) {
         return;
     }
     if (!($f = @fopen($file, "r"))) {
         return;
     }
     fclose($f);
     if (User_Agent::has_capability('ajax_manipulate_dom') || User_Agent::is_preview()) {
         echo 'mwf.util.importJS(\'' . $file . '\');';
     } elseif ($localpath !== null && file_exists($localpath)) {
         include $localpath;
     } else {
         return;
     }
     self::instance()->_imp[] = $file;
 }
Exemplo n.º 2
0
Arquivo: img.php Projeto: ruucla/mwf
    if (isset($_GET['browser_height_percent'])) {
        $max_height = $max_height * $_GET['browser_height_percent'] / 100;
    }
    if (isset($_GET['max_height']) && $_GET['max_height'] < $max_height) {
        $max_height = $_GET['max_height'];
    }
}
/**
 * @var Local_Image work with a local version of the image specified in URI.
 */
$image = new Local_Image($_GET['img']);
/** GIF, JPG, and JPEG are within XHTML MP 1.0 specification. */
$image->set_allowed_extension('gif');
$image->set_allowed_extension('jpeg');
$image->set_allowed_extension('jpg');
/** Allow PNG if user agent has capability. */
if (User_Agent::has_capability('png')) {
    $image->set_allowed_extension('png');
}
/** Force max width if $set_width is true. */
if ($set_width) {
    $image->set_max_width($max_width);
}
/** For max height if $set_height is true. */
if ($set_height) {
    $image->set_max_height($max_height);
}
/** Output the header so that browser treats it as an image rather than PHP file. */
$image->output_header();
/** Output the binary content of the image in its compressed state. */
$image->output_image();