本文整理汇总了PHP中Querys::add_image方法的典型用法代码示例。如果您正苦于以下问题:PHP Querys::add_image方法的具体用法?PHP Querys::add_image怎么用?PHP Querys::add_image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Querys
的用法示例。
在下文中一共展示了Querys::add_image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$fileTypes = array('jpg', 'jpeg', 'gif', 'png');
// File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
$image_ext = $fileParts['extension'];
// Getting the image extention
$image_name = basename($_FILES['Filedata']['name']);
// Getting the image name
// Generating a unique image path
$image_path = md5(rand() * time()) . md5($image_name) . "." . $image_ext;
// Generating a unique thumb image path
$thumb_image_path = "thumb_" . $image_path;
// Complete image path
$targetFile = rtrim($targetPath, '/') . '/' . $image_path;
// Complete thumb image path
$thumbTargetFile = rtrim($targetPath, '/') . '/' . $thumb_image_path;
$complete_image_path = $targetFolder . $image_path;
$complete_thumb_path = $targetFolder . $thumb_image_path;
if (in_array($image_ext, $fileTypes)) {
copy($tempFile, $targetFile);
//move_uploaded_file($tempFile,$targetFile);
$thumb = new thumbnail($targetFile);
$thumb->size_width(400);
$thumb->size_height(300);
$thumb->jpeg_quality(100);
$thumb->save($thumbTargetFile);
$query_obj->add_image($complete_thumb_path, $complete_image_path, "", 1, $dateTime, 1, $dateTime);
echo '1';
} else {
echo 'Invalid file type.';
}
}