Ejemplo n.º 1
0
function createThumbFile($file_path, $file_name, $file_destination, $new_width, $new_height){
	$full_file_path = $file_path . $file_name;

	list($old_width, $old_height, $type, $attr) = getimagesize($full_file_path);
	$file_extention = findFileExtension($file_name);

	if($file_extention == 'jpg' || $file_extention == 'jpeg'){ $src_img = imagecreatefromjpeg($full_file_path); }
	elseif($file_extention == 'png'){ $src_img = imagecreatefrompng($full_file_path); }
	else{ return false; }

	$thumb = getScale($old_width, $old_height, $new_width, $new_height);
    $dst_img = ImageCreateTrueColor($thumb['width'], $thumb['height']);
    $thumb_file = $file_destination . 'thmb_' . $file_name;

    imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb['width'], $thumb['height'], $old_width, $old_height);
    imagejpeg($dst_img, $thumb_file);
    imagedestroy($dst_img);
	imagedestroy($src_img);

	return true;
}
Ejemplo n.º 2
0
			width: width
		});
		$('#flashviewer').dialog('open');
		swfobject.embedSWF(
			url,
			"flashviewer",
			width,
			height,
			"9",
			'<?php 
echo Url::base();
?>
/lib/swfobject/swfobject.js'
		);
		return false;
	});
	
	// set up dialog for images
	$('#imageviewer').dialog({
		modal: true,
		autoOpen: false,
		resizable: false,
		position: 'center',
		height: 'auto',
		width: 'auto'
	});
	
	// images don't use flowplayer, just a standard dialog	
	$('div.image a.thumb.preview').click(function(){
		$('#imageviewer').empty();
		var img = $(this).parent('div.upload').find('img.preview');
Ejemplo n.º 3
0
function createThumbFile($source_file_path, $source_file_name, $thumb_file_path, $thumb_file_name, $thumb_file_width, $thumb_file_height)
{
    list($source_file_width, $source_file_height, $type, $attr) = getimagesize($source_file_path . $source_file_name);
    $source_file_extention = getFileExtension($source_file_name);
    if ($source_file_extention == 'jpg' || $source_file_extention == 'jpeg') {
        $src_img = imagecreatefromjpeg($source_file_path . $source_file_name);
    } elseif ($source_file_extention == 'png') {
        $src_img = imagecreatefrompng($source_file_path . $source_file_name);
    } else {
        return false;
    }
    $thumb = getScale($source_file_width, $source_file_height, $thumb_file_width, $thumb_file_height);
    $dst_img = ImageCreateTrueColor($thumb['width'], $thumb['height']);
    $thumb_file = $thumb_file_path . $thumb_file_name;
    imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb['width'], $thumb['height'], $source_file_width, $source_file_height);
    imagejpeg($dst_img, $thumb_file);
    imagedestroy($dst_img);
    imagedestroy($src_img);
    return true;
}