本文整理汇总了PHP中image::thumbnail方法的典型用法代码示例。如果您正苦于以下问题:PHP image::thumbnail方法的具体用法?PHP image::thumbnail怎么用?PHP image::thumbnail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::thumbnail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$faksimil = $form->input('faksimil');
$email = $form->input('email');
$action = $form->input('action');
$user = $_SESSION['nama'];
$date = date('Y-m-d H:i:s');
// START INSERT DATA ==============================>
if ($action == "insert") {
$foto = $_FILES['foto']['name'];
$id = $number->id('anggota', 5);
$kta_baru = $number->kta($desa_id, $tgl_lahir, $id);
if (empty($foto)) {
$foto = "user.png";
} else {
$source = $_FILES['foto']['tmp_name'];
$image->upload($foto, $source);
$image->thumbnail($foto);
}
$sql = "INSERT INTO anggota\n (id,nama, id_tipe, id_no, jabatan, tempat, tgl_lahir, jns_kelamin, agama,\n pernikahan, pekerjaan_id, pendidikan, alamat, rt, rw, propinsi_id, kota_id, kecamatan_id,\n desa_id, hp, telp_rumah, telp_kantor, faksimil, email, foto, kta_baru, aktif, crt, crt_date) \n VALUES \n ('{$id}','{$nama}','{$id_tipe}','{$id_no}','{$jabatan}','{$tempat}','{$tgl_lahir}','{$jns_kelamin}','{$agama}',\n '{$pernikahan}','{$pekerjaan_id}','{$pendidikan}','{$alamat}','{$rt}','{$rw}','{$propinsi_id}','{$kota_id}','{$kecamatan_id}',\n '{$desa_id}','{$hp}','{$telp_rumah}','{$telp_kantor}','{$faksimil}','{$email}','{$foto}','{$kta_baru}','{$aktif}','{$user}','{$date}')";
if (!$database->query($sql)) {
die($sql);
} else {
$_SESSION['success'] = "<b>Berhasil!</b> Anda telah menambahkan data baru";
header("Location: create.php");
exit;
}
}
// END INSERT DATA ==============================>
// START UPDATE DATA ==============================>
if ($action == "update") {
$id = $form->input('id');
$kta_baru = $number->kta($desa_id, $tgl_lahir, $id);
示例2: crop_image
public function crop_image($file, $size = '200')
{
$this->using('image');
$img = new image();
if ($img->load($file)) {
$img->thumbnail($size);
$img->save();
}
}
示例3: scandir
if ($ext == "png") {
return true;
} else {
if ($ext == "bmp") {
return true;
} else {
return false;
}
}
}
}
}
$dir_contents = scandir($dir);
foreach ($dir_contents as $item) {
if (is_dir($dir . $item) && $item != '.' && $item != '..') {
$dirs[] = $item;
}
}
foreach ($dirs as $current) {
$dir_contents = scandir("./images/" . $current . "/");
foreach ($dir_contents as $item) {
if ($item != '.' && $item != '..' && !is_dir($dir . $item) && is_valid_extension($item) && !file_exists("./thumbnails/{$current}/thumbnail_{$item}")) {
$image = new image();
if (!is_dir("./thumbnails/" . $current . "/")) {
$image->makethumbnailfolder($current);
}
$image->thumbnail($current . "/" . $item);
print "./thumbnails/" . $current . "/thumbnail_" . $item . "<br>\n";
}
}
}
示例4: trim
include '../common.php';
require_once ROOT_PATH . '/include/FileUploader.class.php';
require_once ROOT_PATH . 'include/Image.class.php';
if ($action == 'save' && !empty($title) && !empty($url)) {
$title = m_addslashes($title);
$intro = m_addslashes($content);
$url = trim($url);
$file = $_FILES['uploadpic'];
//文件上传时注意enctype="multipart/form-data"
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['uploadpic']);
$pic = $uf->move(ROOT_PATH . '/video-upimg', 2);
$uppic = $pic[0] ? get_basename($pic[0]) : 'NULL';
$img = new image(ROOT_PATH . 'video-upimg/' . $uppic);
$img->thumbnail(128, 72, ROOT_PATH . 'video-upimg/' . $uppic);
}
$db->query("INSERT INTO `video` VALUES (NULL,'{$title}','{$intro}','{$uppic}','{$url}',now())") or error('Unable to add advertising', __FILE__, __LINE__, $db->error());
refer('添加视频成功');
}
if ($action == 'del' && isset($id)) {
$query_id = $db->query("SELECT img FROM `video` WHERE id = {$id}");
$result = $db->fetch_array($query_id);
$img = $result['img'];
if ($img) {
@unlink(ROOT_PATH . '/video-upimg/' . $img);
}
$db->query("DELETE FROM `video` WHERE id = {$id}") or error('Unable to delete advertising', __FILE__, __LINE__, $db->error());
refer('删除视频成功!');
}
?>
示例5: getimagesize
} else {
$rating = "Safe";
}
}
if ($userc->check_log()) {
$user = $checked_username;
} else {
$user = "Anonymous";
}
$ip = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
$isinfo = getimagesize("./images/" . $iinfo[0] . "/" . $iinfo[1]);
$query = "INSERT INTO {$post_table}(creation_date, hash, image, title, owner, height, width, ext, rating, tags, directory, source, active_date, ip) VALUES(NOW(), '" . md5_file("./images/" . $iinfo[0] . "/" . $iinfo[1]) . "', '" . $iinfo[1] . "', '{$title}', '{$user}', '" . $isinfo[1] . "', '" . $isinfo[0] . "', '{$ext}', '{$rating}', '{$tags}', '" . $iinfo[0] . "', '{$source}', '" . date("Ymd") . "', '{$ip}')";
if (!is_dir("./thumbnails/" . $iinfo[0] . "/")) {
$image->makethumbnailfolder($iinfo[0]);
}
if (!$image->thumbnail($iinfo[0] . "/" . $iinfo[1])) {
print "Thumbnail generation failed! A serious error occured and the image could not be resized.<br /><br />";
}
if (!$db->query($query)) {
print "failed to upload image.";
print $query;
unlink("./images/" . $iinfo[0] . "/" . $iinfo[1]);
$image->folder_index_decrement($iinfo[0]);
$ttags = explode(" ", $tags);
foreach ($ttags as $current) {
$tclass->deleteindextag($current);
}
} else {
$query = "SELECT id, tags FROM {$post_table} WHERE hash='" . md5_file('./images/' . $iinfo[0] . "/" . $iinfo[1]) . "' AND image='" . $iinfo[1] . "' AND directory='" . $iinfo[0] . "' LIMIT 1";
$result = $db->query($query);
$row = $result->fetch_assoc();
示例6: VALUES
if ($rating == "e") {
$rating = "Explicit";
} else {
if ($rating == "q") {
$rating = "Questionable";
} else {
$rating = "Safe";
}
}
if ($userc->check_log()) {
$user = $checked_username;
} else {
$user = "Anonymous";
}
$ip = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
$thumb = $image->thumbnail($iinfo[0] . "/" . $iinfo[1]);
$isinfo = $image->getInfo();
$query = "INSERT INTO {$post_table}(creation_date, hash, image, title, owner, height, width, ext, rating, tags, directory, source, active_date, ip) VALUES(NOW(), '" . md5_file("./images/" . $iinfo[0] . "/" . $iinfo[1]) . "', '" . $iinfo[1] . "', '{$title}', '{$user}', '" . $isinfo[1] . "', '" . $isinfo[0] . "', '{$ext}', '{$rating}', '{$tags}', '" . $iinfo[0] . "', '{$source}', '" . date("Ymd") . "', '{$ip}')";
if (!is_dir("./thumbnails/" . $iinfo[0] . "/")) {
$image->makethumbnailfolder($iinfo[0]);
}
if (!$thumb) {
print "Thumbnail generation failed! A serious error occurred and the image could not be resized.<br /><br />";
}
if (!$db->query($query)) {
print "failed to upload image.";
print $query;
unlink("./images/" . $iinfo[0] . "/" . $iinfo[1]);
$image->folder_index_decrement($iinfo[0]);
$ttags = explode(" ", $tags);
foreach ($ttags as $current) {
示例7: FileUploader
}
require_once '../common.php';
require_once ROOT_PATH . '/include/FileUploader.class.php';
require_once ROOT_PATH . '/include/Image.class.php';
if ($action == 'save' && !empty($name) && !empty($site)) {
$name = m_addslashes($name);
$intro = m_addslashes($intro);
$file = $_FILES['img'];
//文件上传时注意enctype="multipart/form-data"
//Array ( [name] => a002d.gif [type] => image/gif [tmp_name] => d:/webserver/Server/TEMP\php8E.tmp [error] => 0 [size] => 19675 )
if (!empty($file['name'])) {
$uf = new FileUploader($_FILE['img']);
$pic = $uf->move(ROOT_PATH . 'logos', 2);
$uppic = $pic[0] ? get_basename($pic[0]) : 'NULL';
$img = new image(ROOT_PATH . 'logos/' . $uppic);
$img->thumbnail(88, 31, ROOT_PATH . 'logos/' . $uppic);
//$img->watermark(ROOT_PATH . 'include/watermark.png','','',ROOT_PATH . 'images/'.$uppic);
} elseif ($isimg) {
refer('您未选择图片上传!');
}
$db->query("INSERT INTO `links` VALUES (NULL,'{$name}','{$site}','{$intro}','{$isimg}','{$uppic}','1',now())") or error('Unable to add link', __FILE__, __LINE__);
updateLinkCache();
refer('添加成功');
}
if ($action == 'invisable' && isset($v) && isset($id)) {
$v = $v ? 0 : 1;
$db->query("UPDATE `links` SET invisable = '{$v}' WHERE id = {$id}") or error('Unable to set link\'s invisable', __FILE__, __LINE__, $db->error());
updateLinkCache();
refer('操作成功!');
}
if ($action == 'del' && isset($id)) {