<script src="../../../../../../../_admin/scripts/js/validation.js" type="text/javascript"></script>
		<script src="../../../../../../../_admin/scripts/js/swfobject.js" type="text/javascript" ></script>
  		<script src="../../../../../../../_admin/scripts/js/datepicker.js" type="text/javascript"></script>
  		<script src="../../../../../../../_admin/scripts/js/custom.js" type="text/javascript"></script>
		<?
		  	//CHECK TO SEE IF THE USER HAS HELP TURNED ON
			if($user->user_help==1){
			  //IF SO TURN ON THE TOOLTIPS
				print '	<script type="text/javascript">window.onload=function(){enableTooltips()};</script>';
			}
		?>
	</head>
<body>
<script language="JavaScript">
        //alert('begining test\n\nsetting image\n url to "url"\nwidth=11\nheight=12\nalt text = "alt"');
        function setImage(url){
          window.opener.SetUrl(url, 11, 12, "" );
          window.close();
        }
</script>
<? 
$module = new class_files($db, $cfg, $time);
$module->fck_link_view($user, $start, $limit);
?>
</body>
</html>
<?
    //CLOSE OUT CONNECTION TO THE DATABASE
    $db->DB_CLOSE($database_connection);
?>
  		<script src="../../../../../../../_admin/scripts/js/validation.js" type="text/javascript"></script>
		<script src="../../../../../../../_admin/scripts/js/swfobject.js" type="text/javascript" ></script>
  		<script src="../../../../../../../_admin/scripts/js/datepicker.js" type="text/javascript"></script>
  		<script src="../../../../../../../_admin/scripts/js/custom.js" type="text/javascript"></script>
		<?
		  	//CHECK TO SEE IF THE USER HAS HELP TURNED ON
			if($user->user_help==1){
			  //IF SO TURN ON THE TOOLTIPS
				print '	<script type="text/javascript">window.onload=function(){enableTooltips()};</script>';
			}
		?>
	</head>
<body>
<script language="JavaScript">
        //alert('begining test\n\nsetting image\n url to "url"\nwidth=11\nheight=12\nalt text = "alt"');
        function setImage(url){
          window.opener.SetUrl(url, 11, 12, "" );
          window.close();
        }
</script>
<? 
$module = new class_files($db, $cfg, $time);
$module->fck_file_view($user, $start, $limit);
?>
</body>
</html>
<?
    //CLOSE OUT CONNECTION TO THE DATABASE
    $db->DB_CLOSE($database_connection);
?>
Esempio n. 3
0
function create_thumb($source_pic, $allowed_extensions, $t_width, $t_height, $t_suffix = '', $t_path = '', $t_quality = '75', $force_size = false)
{
    if (!class_exists('class_files')) {
        include_once IP_ROOT_PATH . 'includes/class_files.' . PHP_EXT;
    }
    $class_files = new class_files();
    if (!empty($allowed_extensions)) {
        $allowed_extensions = is_array($allowed_extensions) ? $allowed_extensions : array($allowed_extensions);
        $allowed_extensions = array_map('strtolower', $allowed_extensions);
    }
    $file_details = array();
    $pic_fullpath = str_replace(array(' '), array('%20'), $source_pic);
    $file_details = $class_files->get_file_details($source_pic);
    $pic_filename = $file_details['name_full'];
    $pic_title = $file_details['filename'];
    $pic_filetype = $file_details['extension'];
    $pic_title_reg = $class_files->clean_string($pic_title, false);
    $pic_thumbnail = $pic_title . $t_suffix . '.' . $pic_filetype;
    if (!empty($allowed_extensions) && !in_array($pic_filetype, $allowed_extensions)) {
        return false;
    }
    $pic_size = get_full_image_info($source_pic, null, true);
    if ($pic_size == false) {
        return false;
    }
    $pic_width = $pic_size['width'];
    $pic_height = $pic_size['height'];
    $pic_filetype_new = strtolower($pic_size['type']);
    $pic_thumbnail_fullpath = ($t_path == '' ? '' : $t_path . '/') . $pic_thumbnail;
    switch ($pic_filetype_new) {
        case 'gif':
            $img_tmp = @imagecreatefromgif($source_pic);
            break;
        case 'jpg':
            $img_tmp = @imagecreatefromjpeg($source_pic);
            break;
        case 'png':
            $img_tmp = @imagecreatefrompng($source_pic);
            break;
        default:
            return false;
            break;
    }
    $pic_ratio = $pic_width / $pic_height;
    $t_ratio = $t_width / $t_height;
    $x_offset = 0;
    $y_offset = 0;
    $dest_width = $t_width;
    $dest_height = $t_height;
    if (!empty($force_size)) {
        if ($pic_ratio > $t_ratio) {
            $dest_width = $t_height * $pic_ratio;
        } else {
            $dest_height = $t_width / $pic_ratio;
        }
        $x_mid = $dest_width / 2;
        $y_mid = $dest_height / 2;
        $x_offset = round($x_mid - $t_width / 2, 0);
        $y_offset = round($y_mid - $t_height / 2, 0);
        // If we want to crop the image, we need an intermediate image... and we need to reset final width and height
        $img_new = @imagecreatetruecolor($dest_width, $dest_height);
        if (!$img_new) {
            return false;
        }
        @imagealphablending($img_new, false);
        @imagecopyresampled($img_new, $img_tmp, 0, 0, 0, 0, $dest_width, $dest_height, $pic_width, $pic_height);
        @imagesavealpha($img_new, true);
        @imagedestroy($img_tmp);
        $img_tmp = $img_new;
        $dest_width = $t_width;
        $dest_height = $t_height;
        $pic_width = $t_width;
        $pic_height = $t_height;
    } else {
        if ($pic_width <= $t_width && $pic_height <= $t_height) {
            $dest_width = $pic_width;
            $dest_height = $pic_height;
            if ($t_path != '' && !file_exists($t_path)) {
                @mkdir($t_path, 0777);
            }
            @copy($source_pic, $pic_thumbnail_fullpath);
            @chmod($pic_thumbnail_fullpath, 0755);
            return true;
        } else {
            if ($pic_ratio > $t_ratio) {
                $dest_width = round($t_height * $pic_ratio, 0);
            } else {
                $dest_height = round($t_width / $pic_ratio, 0);
            }
        }
    }
    $img_new = @imagecreatetruecolor($dest_width, $dest_height);
    if (!$img_new) {
        return false;
    }
    @imagealphablending($img_new, false);
    @imagecopyresampled($img_new, $img_tmp, 0, 0, $x_offset, $y_offset, $dest_width, $dest_height, $pic_width, $pic_height);
    @imagesavealpha($img_new, true);
    @imagedestroy($img_tmp);
    if ($t_path != '' && !file_exists($t_path)) {
        @mkdir($t_path, 0777);
    }
    // If you want all thumbnails to be forced as JPG you can decomment these lines
    /*
    imagejpeg ($img_new, $pic_thumbnail_fullpath, '75');
    return true;
    exit;
    */
    switch ($pic_filetype) {
        case 'jpg':
            @imagejpeg($img_new, $pic_thumbnail_fullpath, '75');
            break;
        case 'png':
            @imagepng($img_new, $pic_thumbnail_fullpath);
            break;
        case 'gif':
            @imagegif($img_new, $pic_thumbnail_fullpath);
            break;
        default:
            return false;
            exit;
    }
    @chmod($pic_thumbnail_fullpath, 0755);
    @imagedestroy($img_new);
    return true;
}