本文整理汇总了PHP中upload::set_thumbnail_size方法的典型用法代码示例。如果您正苦于以下问题:PHP upload::set_thumbnail_size方法的具体用法?PHP upload::set_thumbnail_size怎么用?PHP upload::set_thumbnail_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类upload
的用法示例。
在下文中一共展示了upload::set_thumbnail_size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
function upload($image)
{
include "upload.inc.php";
// Defining Class
$yukle = new upload();
// Set Max Size
$yukle->set_max_size(180000);
// Set Directory
$yukle->set_directory("/home/jimgreen/public_html/images/" . $image . "");
// Do not change
// Set Temp Name for upload, $_FILES['file']['tmp_name'] is automaticly get the temp name
$yukle->set_tmp_name($_FILES['file']['tmp_name']);
// Do not change
// Set file size, $_FILES['file']['size'] is automaticly get the size
$yukle->set_file_size($_FILES['file']['size']);
// Do not change
// Set File Type, $_FILES['file']['type'] is automaticly get the type
$yukle->set_file_type($_FILES['file']['type']);
// Set File Name, $_FILES['file']['name'] is automaticly get the file name.. you can change
$yukle->set_file_name($_FILES['file']['name']);
// Start Copy Process
$yukle->start_copy();
// If uploaded file is image, you can resize the image width and height
// Support gif, jpg, png
$yukle->resize(218, 218);
// Control File is uploaded or not
// If there is error write the error message
if ($yukle->is_ok()) {
echo "ok";
} else {
echo $yukle->error() . "<br>";
}
// Set a thumbnail name
$yukle->set_thumbnail_name("thumb1");
// create thumbnail
$yukle->create_thumbnail();
// change thumbnail size
$yukle->set_thumbnail_size(0, 250);
$yukle->set_thumbnail_name("thumb2");
$yukle->create_thumbnail();
$yukle->set_thumbnail_size(50, 0);
$yukle->set_thumbnail_name("thumb3");
$yukle->create_thumbnail();
$yukle->set_thumbnail_size(62, 150);
}
示例2: upload
$yukle = new upload();
$yukle->set_max_size(99999999);
$yukle->set_directory('../../images-clientes');
$yukle->set_tmp_name($_FILES['logo']['tmp_name']);
$yukle->set_file_size($_FILES['logo']['size']);
$yukle->set_file_type($_FILES['logo']['type']);
//random
$random = substr(md5(rand()), 0, 6);
$avatarname = $random . '_' . $_FILES['logo']['name'];
$nombre_final = str_replace(' ', '-', $avatarname);
$yukle->set_file_name($nombre_final);
$yukle->start_copy();
$yukle->resize(620, 0);
$yukle->set_thumbnail_name('tn_' . $nombre_final);
$yukle->create_thumbnail();
$yukle->set_thumbnail_size(300, 0);
if ($yukle->is_ok()) {
$logo = $nombre_final;
} else {
//si hay error cargo sin imagen
$logo = "";
}
}
/* INSERT */
include_once "classes/class.usuarios.php";
$usuarios = new usuarios();
$usuarios->idUsuario = $idUsuario;
$usuarios->strNombre = $strNombre;
$usuarios->strApellido = $strApellido;
$usuarios->strEmail = $strEmail;
$usuarios->strEmpresa = $strEmpresa;
示例3: upload_file
public function upload_file()
{
//1 = OK - 0 = Failure
$file = array('status' => '', 'filename' => '', 'msg' => '');
//check ext.
$file_extensions_allowed = array('image/gif', 'image/png', 'image/jpeg', 'image/jpg');
$exts_humano = array('gif', 'png', 'jpeg', 'jpg');
$exts_humano = implode(', ', $exts_humano);
$ext = $_FILES['filename']['type'];
#$ext = strtolower($ext);
if (!in_array($ext, $file_extensions_allowed)) {
$exts = implode(', ', $file_extensions_allowed);
$file['msg'] .= "<p>" . $_FILES['filename']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
} else {
include APPPATH . 'libraries/class.upload.php';
$yukle = new upload();
$yukle->set_max_size(1900000);
$yukle->set_directory('./images-productos');
$yukle->set_tmp_name($_FILES['filename']['tmp_name']);
$yukle->set_file_size($_FILES['filename']['size']);
$yukle->set_file_type($_FILES['filename']['type']);
$random = substr(md5(rand()), 0, 6);
$name_whitout_whitespaces = str_replace(" ", "-", $_FILES['filename']['name']);
$imagname = '' . $random . '_' . $name_whitout_whitespaces;
#$thumbname='tn_'.$imagname;
$yukle->set_file_name($imagname);
$yukle->start_copy();
if ($yukle->is_ok()) {
if (count($this->data['thumbnail_sizes'])) {
foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
//create thumbnail
$yukle->resize(1000, 0);
$yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
$result_thumb = $yukle->create_thumbnail();
$yukle->set_thumbnail_size($thumb_size, 0);
}
}
//UPLOAD ok
$file['filename'] = $imagname;
$file['status'] = 1;
} else {
$file['status'] = 0;
$file['msg'] = 'Error al subir archivo';
}
//clean
$yukle->set_tmp_name('');
$yukle->set_file_size('');
$yukle->set_file_type('');
$imagname = '';
}
//fin if(extencion)
return $file;
}
示例4: upload_file
public function upload_file()
{
//1 = OK - 0 = Failure
$file = array('status' => '', 'filename' => '', 'msg' => '');
array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
//check extencion
/*
$file_extensions_allowed = array('application/pdf', 'application/msword', 'application/rtf', 'application/vnd.ms-excel','application/vnd.ms-powerpoint','application/zip','application/x-rar-compressed', 'text/plain');
$exts_humano = array('PDF', 'WORD', 'RTF', 'EXCEL', 'PowerPoint', 'ZIP', 'RAR');
*/
$file_extensions_allowed = array('image/jpeg', 'image/pjpeg', 'image/jpg', 'image/png', 'image/gif', 'image/bmp');
$exts_humano = array('JPG', 'JPEG', 'PNG', 'GIF');
$exts_humano = implode(', ', $exts_humano);
$ext = $_FILES['adjunto']['type'];
#$ext = strtolower($ext);
if (!in_array($ext, $file_extensions_allowed)) {
$exts = implode(', ', $file_extensions_allowed);
$file['msg'] .= "<p>" . $_FILES['adjunto']['name'] . " <br />Puede subir archivos que tengan alguna de estas extenciones: " . $exts_humano . "</p>";
$file['status'] = 0;
} else {
include APPPATH . 'libraries/class.upload.php';
$yukle = new upload();
$yukle->set_max_size(1900000);
$yukle->set_directory('./images-lugares');
$yukle->set_tmp_name($_FILES['adjunto']['tmp_name']);
$yukle->set_file_size($_FILES['adjunto']['size']);
$yukle->set_file_type($_FILES['adjunto']['type']);
$random = substr(md5(rand()), 0, 6);
$name_whitout_whitespaces = str_replace(" ", "-", $_FILES['adjunto']['name']);
$imagname = '' . $random . '_' . $name_whitout_whitespaces;
#$thumbname='tn_'.$imagname;
$yukle->set_file_name($imagname);
$yukle->start_copy();
if ($yukle->is_ok()) {
if (count($this->data['thumbnail_sizes'])) {
foreach ($this->data['thumbnail_sizes'] as $thumb_size) {
//create thumbnail
$yukle->resize(1000, 0);
$yukle->set_thumbnail_name('tn_' . $thumb_size . '_' . $imagname);
$result_thumb = $yukle->create_thumbnail();
$yukle->set_thumbnail_size($thumb_size, 0);
}
}
//UPLOAD ok
$file['filename'] = $imagname;
$file['status'] = 1;
} else {
$file['status'] = 0;
$file['msg'] = 'Error al subir archivo';
}
//clean
$yukle->set_tmp_name('');
$yukle->set_file_size('');
$yukle->set_file_type('');
$imagname = '';
}
//fin if(extencion)
return $file;
}