本文整理汇总了PHP中create_thumbnail函数的典型用法代码示例。如果您正苦于以下问题:PHP create_thumbnail函数的具体用法?PHP create_thumbnail怎么用?PHP create_thumbnail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_thumbnail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleEditValidationSuccess
protected function handleEditValidationSuccess($video, $site = '')
{
if ($video->Id == NULL) {
$uplPath = $this->config->item('resource_folder') . '/video';
$uplConfig['upload_path'] = $uplPath;
$uplConfig['allowed_types'] = '*';
$this->load->library('upload', $uplConfig);
if ($this->upload->do_upload('uplVideo')) {
$data = $this->upload->data();
$outputFile = $this->convertVideo($uplPath . '/' . $data['file_name']);
$thumbnailPath = $this->config->item('resource_folder') . '/video_thumbnail';
$thumbnailFile = create_thumbnail($outputFile, $this->config->item('thumbnail_video_width'), $this->config->item('thumbnail_video_height'), $thumbnailPath);
if ($outputFile && $thumbnailFile) {
$resourceVideo = new Resource_model();
$resourceVideo->Path = $outputFile;
$resourceVideoId = $resourceVideo->save();
$resourceThumbnail = new Resource_model();
$resourceThumbnail->Path = $thumbnailFile;
$resourceThumbnailId = $resourceThumbnail->save();
}
} else {
$this->addDataForView('err', $this->upload->display_errors('<div>', '</div>'));
$this->template->load($this->template_admin, $this->getEditViewName(), $this->getDataForView());
return;
}
if (isset($resourceVideoId)) {
$video->IdResource = $resourceVideoId;
$video->IdThumbnail = $resourceThumbnailId;
$video->OwnerBy = $this->Account_model->getLoggedInUserId();
}
}
parent::handleEditValidationSuccess($video, $site);
}
示例2: return_img_thumb
public function return_img_thumb($src)
{
$input = \Request::all();
$width = isset($input['width']) ? $input['width'] : 140;
$height = isset($input['height']) ? $input['height'] : 140;
$save = isset($input['save']);
$path_array = explode(".", $src);
$ext = array_pop($path_array);
$file_path = implode(".", $path_array);
$thumb_format = $file_path . "-{$width}" . "x" . "{$height}.jpg";
if (file_exists(real_imgs_dir . $thumb_format)) {
$img = imgs_dir . $thumb_format;
} else {
// Create Thumb
if (!file_exists(real_imgs_dir . $src)) {
die("{$src} --> image doesn't exist.");
} else {
// dd();
$save_dir = false;
if (CREATE_THUMBS && $save) {
$save_dir = real_imgs_dir . $thumb_format;
} elseif ($width != 140 || $height != 140) {
$save_dir = false;
}
//if !=140 don't save
// dd($save_dir);
create_thumbnail(real_imgs_dir . $src, $save_dir, $width, $height);
$img = imgs_dir . $thumb_format;
}
// die("fuck Get Thumb Didn't work on : $src");
}
$this->return_img($img, 'jpg');
}
示例3: listFiles
function listFiles($dir)
{
global $cfg;
$list = array();
$full = $cfg['root'] . trim($dir, '/\\') . DIR_SEP;
$thumb = $cfg['root'] . $cfg['thumb']['dir'] . DIR_SEP . trim($dir, '/\\') . DIR_SEP;
$files = scandir($full);
natcasesort($files);
for ($i = -1, $iCount = count($files); ++$i < $iCount;) {
$ext = substr($files[$i], strrpos($files[$i], '.') + 1);
if (!in_array($files[$i], $cfg['hide']['file']) && !in_array($ext, $cfg['deny'][$cfg['type']]) && in_array($ext, $cfg['allow'][$cfg['type']]) && is_file($full . $files[$i])) {
$imgSize = array(0, 0);
if (in_array($ext, $cfg['allow']['image'])) {
if ($cfg['thumb']['auto'] && !file_exists($thumb . $files[$i])) {
create_thumbnail($full . $files[$i], $thumb . $files[$i]);
}
$imgSize = getimagesize($full . $files[$i]);
}
$stats = getSize($full . $files[$i]);
$list[] = array('name' => $files[$i], 'ext' => $ext, 'width' => $imgSize[0], 'height' => $imgSize[1], 'size' => $stats['_size'], 'date' => date($cfg['thumb']['date'], $stats['mtime']), 'r_size' => $stats['size'], 'mtime' => $stats['mtime'], 'thumb' => '/' . $cfg['url'] . '/' . $cfg['thumb']['dir'] . '/' . $dir . $files[$i]);
}
}
switch ($cfg['sort']) {
case 'size':
usort($list, 'sortSize');
break;
case 'date':
usort($list, 'sortDate');
break;
default:
//name
break;
}
return $list;
}
示例4: edit_post
public function edit_post()
{
$data = array();
if (!($user = $this->user->get($this->user_id))) {
$this->response(array('msg', 'User not found, call Grumpy cat!'), 500);
}
if ($this->post('username')) {
if ($this->user->get_by(array('us_username' => $this->post('username'), 'us_id !=' => $this->user_id))) {
$this->response(array('msg', 'Username already used'), 201);
}
$data['us_username'] = $this->post('username');
}
if ($this->post('email')) {
if ($this->user->get_by(array('us_email' => $this->post('email'), 'us_id !=' => $this->user_id))) {
$this->response(array('msg', 'Email already used'), 201);
}
$data['us_email'] = $this->post('email');
}
if ($this->post('first_name')) {
$data['us_first_name'] = $this->post('first_name');
}
if ($this->post('last_name')) {
$data['us_last_name'] = $this->post('last_name');
}
if ($this->post('pwd')) {
$data['us_password'] = $this->post('pwd');
}
if ($this->post('gender')) {
$data['us_gender'] = $this->post('gender');
}
if ($this->post('dob')) {
$data['us_dob'] = date('Y-m-d', strtotime($this->post('dob')));
}
if ($this->post('us_avatar')) {
$data['us_avatar'] = $this->post('us_avatar');
}
if (!empty($_FILES['photo'])) {
$path = 'uploads/users/';
$name = 'profile_picture_' . $user['us_id'] . time();
$unlink_picture = $path . $user['us_avatar'];
$upload_file = $this->_upload_profile($name, $path, $_FILES['photo']);
if ($upload_file == FALSE) {
$this->response(array('msg' => 'BAD REQUEST, ERROR PHOTO'), 400);
} else {
if (file_exists($unlink_picture) && $user['us_avatar'] != '') {
unlink($unlink_picture);
}
create_thumbnail($path . $upload_file, '800', '800', $path . $upload_file);
$data['us_avatar'] = $upload_file;
}
}
$data['us_user_modified'] = $this->user_username;
$data['us_date_modified'] = date('Y-m-d H:i:s');
if ($this->user->update($this->user_id, $data)) {
$this->response(array('msg', 'Success'), 200);
} else {
$this->response(array('msg', 'Database Problem, call Grumpy cat!'), 500);
}
}
示例5: makethumbnail
function makethumbnail($image_name, $src, $dest)
{
global $_CONF, $CONF_SE;
$do_create = 0;
if ($image_info = @getimagesize($src)) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_create = 1;
}
}
if ($do_create) {
$dimension = intval($CONF_SE['auto_thumbnail_dimension']) ? intval($CONF_SE['auto_thumbnail_dimension']) : 100;
$resize_type = intval($CONF_SE['auto_thumbnail_resize_type']) ? intval($CONF_SE['auto_thumbnail_resize_type']) : 1;
$quality = intval($CONF_SE['auto_thumbnail_quality']) && intval($CONF_SE['auto_thumbnail_quality']) <= 100 ? intval($CONF_SE['auto_thumbnail_quality']) : 100;
if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {
$new_thumb_name = $new_name;
$chmod = @chmod($dest, $CONF_SE['image_perms']);
}
}
}
示例6: get_thumb
function get_thumb($src, $width = 140, $height = 140)
{
// th($src,$width,$height);
// die;
// die('hello');
$path_array = explode(".", $src);
$ext = array_pop($path_array);
$file_path = implode(".", $path_array);
$thumb_format = $file_path . "-{$width}" . "x" . "{$height}.jpg";
// --------------------just temprory--------------------------------------------------
// if(file_exists(real_imgs_dir.$thumb_format)){
// // die("1-".imgs_dir.$thumb_format);
// return imgs_dir.$thumb_format;
// }elseif(file_exists(real_imgs_dir.$file_path.".".$ext)){
// die("2-");
// return imgs_dir.$file_path.".".$ext;
// }else{
// die("3-".real_imgs_dir.$file_path.".".$ext);
// return '';
// }
// ----------------------------------------------------------------------
if (file_exists(real_imgs_dir . $thumb_format)) {
// die("file_exists: ".real_imgs_dir.$thumb_format);
return imgs_dir . $thumb_format;
} else {
// Create Thumb
if (!file_exists(real_imgs_dir . $src)) {
die("{$src} --> image doesn't exist.");
} else {
// die("Current image is: $src") ;
create_thumbnail(real_imgs_dir . $src, real_imgs_dir . $thumb_format, $width, $height);
return imgs_dir . $thumb_format;
}
die("fuck Get Thumb Didn't work on : {$src}");
}
}
示例7: str_replace
} else {
$log[] = str_replace("{name}", str_replace(ROOT_PATH, "", $backup_orig) . "/" . $cat_id . "/" . $image_media_file, $lang['cni_backup_error']);
}
}
$file_thumb = THUMB_PATH . "/" . $cat_id . "/" . $image_media_file;
if ($do_thumb && $auto_thumbs && $image_thumb_file == "" && !file_exists($file_thumb)) {
$ok = 0;
if ($resize_type_thumbs == 1 && ($image_info[0] > $dimension_thumbs || $image_info[1] > $dimension_thumbs)) {
$ok = 1;
} elseif ($resize_type_thumbs == 2 && $image_info[0] > $dimension_thumbs) {
$ok = 1;
} elseif ($resize_type_thumbs == 3 && $image_info[1] > $dimension_thumbs) {
$ok = 1;
}
if ($ok) {
if (create_thumbnail($file, $file_thumb, $quality_thumbs, $dimension_thumbs, $resize_type_thumbs)) {
$log[] = $lang['cni_thumbnail_success'];
$image_thumb_file = $image_media_file;
} else {
$log[] = $lang['cni_thumbnail_error'];
$image_thumb_file = "";
}
}
}
if ($do_resize) {
if (resize_image($file, $quality, $dimension, $resize_type)) {
$log[] = $lang['cni_resized_success'];
} else {
$log[] = $lang['cni_resized_error'];
}
}
示例8: upload_attachment
/**
* Upload Attachment - filedata is generated here
* Uses upload class
*
* @param string $form_name The form name of the file upload input
* @param int $forum_id The id of the forum
* @param bool $local Whether the file is local or not
* @param string $local_storage The path to the local file
* @param bool $is_message Whether it is a PM or not
* @param \filespec $local_filedata A filespec object created for the local file
* @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype guesser object if used
* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used
*
* @return object filespec
*/
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container;
$filedata = array('error' => array());
$upload = $phpbb_container->get('files.upload');
if ($config['check_attachment_content'] && isset($config['mime_triggers'])) {
$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
} else {
if (!$config['check_attachment_content']) {
$upload->set_disallowed_content(array());
}
}
$filedata['post_attach'] = $local || $upload->is_valid($form_name);
if (!$filedata['post_attach']) {
$filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND'];
return $filedata;
}
$extensions = $cache->obtain_attach_extensions($is_message ? false : (int) $forum_id);
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
/** @var \phpbb\files\filespec $file */
$file = $local ? $upload->handle_upload('files.types.local', $local_storage, $local_filedata) : $upload->handle_upload('files.types.form', $form_name);
if ($file->init_error()) {
$filedata['post_attach'] = false;
return $filedata;
}
// Whether the uploaded file is in the image category
$is_image = isset($extensions[$file->get('extension')]['display_cat']) ? $extensions[$file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false;
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id)) {
// Check Image Size, if it is an image
if ($is_image) {
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
}
// Admins and mods are allowed to exceed the allowed filesize
if (!empty($extensions[$file->get('extension')]['max_filesize'])) {
$allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
} else {
$allowed_filesize = $is_message ? $config['max_filesize_pm'] : $config['max_filesize'];
}
$file->upload->set_max_filesize($allowed_filesize);
}
$file->clean_filename('unique', $user->data['user_id'] . '_');
// Are we uploading an image *and* this image being within the image category?
// Only then perform additional image checks.
$file->move_file($config['upload_path'], false, !$is_image);
// Do we have to create a thumbnail?
$filedata['thumbnail'] = $is_image && $config['img_create_thumbnail'] ? 1 : 0;
if (sizeof($file->error)) {
$file->remove();
$filedata['error'] = array_merge($filedata['error'], $file->error);
$filedata['post_attach'] = false;
return $filedata;
}
// Make sure the image category only holds valid images...
if ($is_image && !$file->is_image()) {
$file->remove();
if ($plupload && $plupload->is_active()) {
$plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE');
}
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
// Since the image category is displaying content inline we need to catch this.
trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
}
$filedata['filesize'] = $file->get('filesize');
$filedata['mimetype'] = $file->get('mimetype');
$filedata['extension'] = $file->get('extension');
$filedata['physical_filename'] = $file->get('realname');
$filedata['real_filename'] = $file->get('uploadname');
$filedata['filetime'] = time();
/**
* Event to modify uploaded file before submit to the post
*
* @event core.modify_uploaded_file
* @var array filedata Array containing uploaded file data
* @var bool is_image Flag indicating if the file is an image
* @since 3.1.0-RC3
*/
$vars = array('filedata', 'is_image');
extract($phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars)));
// Check our complete quota
if ($config['attachment_quota']) {
if ($config['upload_dir_size'] + $file->get('filesize') > $config['attachment_quota']) {
$filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
$filedata['post_attach'] = false;
$file->remove();
//.........这里部分代码省略.........
示例9: upload_attachment
/**
* Upload Attachment - filedata is generated here
* Uses upload class
*/
function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
{
global $auth, $user, $config, $db, $cache;
global $phpbb_root_path, $phpEx;
$filedata = array('error' => array());
include_once $phpbb_root_path . 'includes/functions_upload.' . $phpEx;
$upload = new fileupload();
if ($config['check_attachment_content'] && isset($config['mime_triggers'])) {
$upload->set_disallowed_content(explode('|', $config['mime_triggers']));
}
if (!$local) {
$filedata['post_attach'] = $upload->is_valid($form_name) ? true : false;
} else {
$filedata['post_attach'] = true;
}
if (!$filedata['post_attach']) {
$filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND'];
return $filedata;
}
$extensions = $cache->obtain_attach_extensions($is_message ? false : (int) $forum_id);
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
$file = $local ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name);
if ($file->init_error) {
$filedata['post_attach'] = false;
return $filedata;
}
$cat_id = isset($extensions[$file->get('extension')]['display_cat']) ? $extensions[$file->get('extension')]['display_cat'] : ATTACHMENT_CATEGORY_NONE;
// Make sure the image category only holds valid images...
if ($cat_id == ATTACHMENT_CATEGORY_IMAGE && !$file->is_image()) {
$file->remove();
// If this error occurs a user tried to exploit an IE Bug by renaming extensions
// Since the image category is displaying content inline we need to catch this.
trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
}
// Do we have to create a thumbnail?
$filedata['thumbnail'] = $cat_id == ATTACHMENT_CATEGORY_IMAGE && $config['img_create_thumbnail'] ? 1 : 0;
// Check Image Size, if it is an image
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id) && $cat_id == ATTACHMENT_CATEGORY_IMAGE) {
$file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
}
// Admins and mods are allowed to exceed the allowed filesize
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id)) {
if (!empty($extensions[$file->get('extension')]['max_filesize'])) {
$allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
} else {
$allowed_filesize = $is_message ? $config['max_filesize_pm'] : $config['max_filesize'];
}
$file->upload->set_max_filesize($allowed_filesize);
}
$file->clean_filename('unique', $user->data['user_id'] . '_');
// Are we uploading an image *and* this image being within the image category? Only then perform additional image checks.
$no_image = $cat_id == ATTACHMENT_CATEGORY_IMAGE ? false : true;
$file->move_file($config['upload_path'], false, $no_image);
if (sizeof($file->error)) {
$file->remove();
$filedata['error'] = array_merge($filedata['error'], $file->error);
$filedata['post_attach'] = false;
return $filedata;
}
$filedata['filesize'] = $file->get('filesize');
$filedata['mimetype'] = $file->get('mimetype');
$filedata['extension'] = $file->get('extension');
$filedata['physical_filename'] = $file->get('realname');
$filedata['real_filename'] = $file->get('uploadname');
$filedata['filetime'] = time();
// Check our complete quota
if ($config['attachment_quota']) {
if ($config['upload_dir_size'] + $file->get('filesize') > $config['attachment_quota']) {
$filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
$filedata['post_attach'] = false;
$file->remove();
return $filedata;
}
}
// Check free disk space
if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path'])) {
if ($free_space <= $file->get('filesize')) {
$filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
$filedata['post_attach'] = false;
$file->remove();
return $filedata;
}
}
// Create Thumbnail
if ($filedata['thumbnail']) {
$source = $file->get('destination_file');
$destination = $file->get('destination_path') . '/thumb_' . $file->get('realname');
if (!create_thumbnail($source, $destination, $file->get('mimetype'))) {
$filedata['thumbnail'] = 0;
}
}
return $filedata;
}
示例10: display_thumbnails
/**
* display a page of thumbnails
*
* @copyright (c) 2001-2011, Universite catholique de Louvain (UCL)
* @param imageList (array) list containing all image file names
* @param fileList (array) file properties
* @param page (int) current page number
* @param thumbnailWidth (int) width of thumbnails
* @param colWidth (int) width of columns
* @param numberOfCols (int) number of columns
* @param numberOfRows (int) number of rows
* @global curDirPath
*/
function display_thumbnails($imageList, $fileList, $page, $thumbnailWidth, $colWidth, $numberOfCols, $numberOfRows)
{
global $curDirPath;
global $searchCmdUrl;
// get index of first thumbnail on the page
$displayed = get_offset($page);
$html = '';
// loop on rows
for ($rows = 0; $rows < $numberOfRows; $rows++) {
$html .= "<tr>\n";
// loop on columns
for ($cols = 0; $cols < $numberOfCols; $cols++) {
// get index of image
$num = $imageList[$displayed];
// get file name
$fileName = $fileList[$num]['path'];
// visibility style
if ($fileList[$num]['visibility'] == 'i') {
$style = "style=\"font-style: italic; color: silver;\"";
} else {
$style = '';
}
// display thumbnail
/*echo "<td style=\"text-align: center;\" style=\"width:"
. $colWidth . "%;\">\n"
;*/
// omit colwidth since already in th
$html .= "<td style=\"text-align: center;\">\n";
$html .= "<a href=\"" . claro_htmlspecialchars(Url::Contextualize($_SERVER['PHP_SELF'] . "?docView=image&file=" . download_url_encode($fileName) . "&cwd=" . $curDirPath . $searchCmdUrl)) . "\">";
// display image description using title attribute
$title = "";
if ($fileList[$num]['comment']) {
$text = $fileList[$num]['comment'];
$text = cutstring($text, 40, false, 5, "...");
$title = "title=\"" . $text . "\"";
}
$html .= create_thumbnail($fileName, $thumbnailWidth, $title);
// unset title for the next pass in the loop
unset($title);
$html .= "</a>\n";
// display image name
$imgName = strlen(basename($fileList[$num]['path'])) > 25 ? substr(basename($fileList[$num]['path']), 0, 25) . "..." : basename($fileList[$num]['path']);
$html .= "<p " . $style . ">" . $imgName . "</p>";
$html .= "</td>\n";
// update image number
$displayed++;
// finished ?
if ($displayed >= count($imageList)) {
$html .= "</tr>\n";
return $html;
}
}
// end loop on columns
$html .= "</tr>\n";
}
// end loop on rows
return $html;
}
示例11: session_start
$logo = "../";
$title = "Control panel | ";
session_start();
include '../connect.php';
$username = $_SESSION["user"];
if (!empty($_SESSION['user'])) {
//if(isset($_POST['fupload'])) {
require 'image_inc.php';
if (isset($_FILES['fupload'])) {
if (preg_match('/[.](jpg)|(gif)|(png)$/', $_FILES['fupload']['name'])) {
$filename = $_FILES['fupload']['name'];
$source = $_FILES['fupload']['tmp_name'];
$path_to_image_directory = 'images/fullsized/';
$target = $path_to_image_directory . $filename;
move_uploaded_file($source, $target);
create_thumbnail($filename, $filename . '_thumb.png', 100, 100);
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="author" content="" />
<title>Dynamic Thumbnails</title>
</head>
<body>
示例12: create_thumbnail
create_thumbnail($uploaddir, $large, $new_width = 'auto', $new_height = 350, $quality = 70);
$hasil = $koneksi_db->sql_query("INSERT INTO photo (gambar,peristiwa,keterangan) VALUES ('{$simpan}','{$peristiwa}','{$keterangan4}')");
$admin .= '<div class="sukses">Photo 4 Berhasil dimasukkan ke database</div>';
unlink($uploaddir);
}
if (!empty($image_name5)) {
$files = $_FILES['image5']['name'];
$tmp_files = $_FILES['image5']['tmp_name'];
$simpan = md5(rand(1, 100) . $files) . '.jpg';
$uploaddir = $temp . $simpan;
$uploads = move_uploaded_file($tmp_files, $uploaddir);
if (file_exists($uploaddir)) {
@chmod($uploaddir, 0644);
}
$large = $normal . $simpan;
create_thumbnail($uploaddir, $large, $new_width = 'auto', $new_height = 350, $quality = 70);
$hasil = $koneksi_db->sql_query("INSERT INTO photo (gambar,peristiwa,keterangan) VALUES ('{$simpan}','{$peristiwa}','{$keterangan5}')");
$admin .= '<div class="sukses">Photo 5 Berhasil dimasukkan ke database</div>';
unlink($uploaddir);
}
}
$hasil = $koneksi_db->sql_query("SELECT * FROM photo_peristiwa WHERE id={$id}");
$data = $koneksi_db->sql_fetchrow($hasil);
$id = $data['id'];
$idperistiwa = $data['id'];
$judulperistiwa = $data['judul'];
$admin .= '<div class="border">';
$admin .= '<table><tr><td>List Photo Peristiwa </td><td> <b>
<a href=admin.php?pilih=photo&mod=yes&aksi=editperistiwa&id=' . $id . '>
' . $judulperistiwa . '</a></b></td></tr></table>';
$admin .= '<table><tr>';
示例13: isset
$height = isset($_POST['resizeHeight']) ? intval($_POST['resizeHeight']) : 0;
$key = 'uploadFiles';
if (!empty($dir) && '/' != $dir && !empty($_FILES[$key])) {
for ($i = -1, $iCount = count($_FILES[$key]['name']); ++$i < $iCount;) {
$ext = substr($_FILES[$key]['name'][$i], strrpos($_FILES[$key]['name'][$i], '.') + 1);
if (!in_array($ext, $cfg['deny'][$cfg['type']]) && in_array($ext, $cfg['allow'][$cfg['type']])) {
$freeName = getFreeFileName($_FILES[$key]['name'][$i], $cfg['root'] . $dir);
if (in_array($ext, $cfg['allow']['image'])) {
if ($width || $height) {
create_thumbnail($_FILES[$key]['tmp_name'][$i], $cfg['root'] . $dir . $freeName, $width, $height, 100, false, true);
chmod($cfg['root'] . $dir . $freeName, $cfg['chmod']['file']);
} else {
if (move_uploaded_file($_FILES[$key]['tmp_name'][$i], $cfg['root'] . $dir . $freeName)) {
chmod($cfg['root'] . $dir . $freeName, $cfg['chmod']['file']);
if ($cfg['thumb']['auto']) {
create_thumbnail($cfg['root'] . $dir . $freeName, $cfg['root'] . $cfg['thumb']['dir'] . DIR_SEP . $dir . DIR_SEP . $freeName);
chmod($cfg['root'] . $cfg['thumb']['dir'] . DIR_SEP . $dir . DIR_SEP . $freeName, $cfg['chmod']['file']);
}
$reply['downloaded'][] = array(true, $freeName);
} else {
$reply['downloaded'][] = array(false, $freeName);
}
}
} else {
if (move_uploaded_file($_FILES[$key]['tmp_name'][$i], $cfg['root'] . $dir . $freeName)) {
chmod($cfg['root'] . $dir . $freeName, $cfg['chmod']['file']);
$reply['downloaded'][] = array(true, $freeName);
} else {
$reply['downloaded'][] = array(false, $freeName);
}
}
示例14: move_uploaded_attachment
function move_uploaded_attachment($upload_mode, $file)
{
global $error, $error_msg, $lang, $upload_dir;
if (!is_uploaded_file($file)) {
message_die(GENERAL_ERROR, 'Unable to upload file. The given source has not been uploaded.', __LINE__, __FILE__);
}
switch ($upload_mode) {
case 'copy':
if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename))) {
if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename))) {
$error = TRUE;
if (!empty($error_msg)) {
$error_msg .= '<br />';
}
$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
return;
}
}
@chmod($upload_dir . '/' . basename($this->attach_filename), 0666);
break;
case 'move':
if (!@move_uploaded_file($file, $upload_dir . '/' . basename($this->attach_filename))) {
if (!@copy($file, $upload_dir . '/' . basename($this->attach_filename))) {
$error = TRUE;
if (!empty($error_msg)) {
$error_msg .= '<br />';
}
$error_msg .= sprintf($lang['General_upload_error'], './' . $upload_dir . '/' . $this->attach_filename);
return;
}
}
@chmod($upload_dir . '/' . $this->attach_filename, 0666);
break;
case 'ftp':
ftp_file($file, basename($this->attach_filename), $this->type);
break;
}
if (!$error && $this->thumbnail == 1) {
if ($upload_mode == 'ftp') {
$source = $file;
$dest_file = THUMB_DIR . '/t_' . basename($this->attach_filename);
} else {
$source = $upload_dir . '/' . basename($this->attach_filename);
$dest_file = amod_realpath($upload_dir);
$dest_file .= '/' . THUMB_DIR . '/t_' . basename($this->attach_filename);
}
if (!create_thumbnail($source, $dest_file, $this->type)) {
if (!$file || !create_thumbnail($file, $dest_file, $this->type)) {
$this->thumbnail = 0;
}
}
}
}
示例15: CheckLogin
include_once '../pv_core.php';
include_once '../modules/module_imagefunctions.php';
}
global $Pivot_Vars;
CheckLogin();
chdir($Paths['upload_path']);
// -- main --
if (!$img) {
$img = $Pivot_Vars['image'];
}
// get original image attributes
$attr = get_image_attributes($img);
$img = new Attributes($attr['name'], $attr['w'], $attr['h'], $attr['x'], $attr['y']);
if (isset($Pivot_Vars['crop'])) {
// create the thumbnail!
create_thumbnail();
} else {
// show the JS crop editor!
print_crop_editor();
}
// -- main --
// Nothing to change from here
// -------------------------------
function get_image_attributes($img)
{
if (!file_exists($img)) {
$img = stripslashes(urldecode($img));
}
if (!file_exists($img)) {
echo "<br />{$img} can not be opened. <br />";
echo "Current Path: " . getcwd() . "<br />";