本文整理汇总了PHP中SimpleImage::getHeight方法的典型用法代码示例。如果您正苦于以下问题:PHP SimpleImage::getHeight方法的具体用法?PHP SimpleImage::getHeight怎么用?PHP SimpleImage::getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleImage
的用法示例。
在下文中一共展示了SimpleImage::getHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resizeImagesInFolder
function resizeImagesInFolder($dir, $i)
{
if (!is_dir('cover/' . $dir)) {
toFolder('cover/' . $dir);
}
$files = scandir($dir);
foreach ($files as $key => $file) {
if ($file != '.' && $file != '..') {
if (!is_dir($dir . '/' . $file)) {
echo $dir . '/' . $file;
$image = new SimpleImage();
$image->load($dir . '/' . $file);
if ($image->getHeight() < $image->getWidth()) {
$image->resizeToWidth(1920);
} else {
$image->resizeToHeight(1920);
}
// $new = 'cover/' . $dir . '/'.$image->name;
if ($i < 10) {
$new = 'cover/' . $dir . '/00' . $i . '.' . $image->type;
} elseif ($i < 100) {
$new = 'cover/' . $dir . '/0' . $i . '.' . $image->type;
} else {
$new = 'cover/' . $dir . '/' . $i . '.' . $image->type;
}
$image->save($new);
echo ' ---------> ' . $new . '<br>';
$i++;
} else {
resizeImagesInFolder($dir . '/' . $file, 1);
}
}
}
}
示例2: uploadArquivo
function uploadArquivo($campoFormulario, $idGravado) {
$ext = pathinfo($_FILES[$campoFormulario][name], PATHINFO_EXTENSION);
if (($_FILES[$campoFormulario][name] <> "") && ($_FILES[$campoFormulario][size]) > 0 && in_array(strtolower($ext), $this->extensions)) {
$arquivoTmp = $_FILES[$campoFormulario]['tmp_name'];
$nome = str_replace(".", "", microtime(true)) . "_" . $_FILES[$campoFormulario]['name'];
if (function_exists("exif_imagetype")) {
$test = exif_imagetype($arquivoTmp);
$image_type = $test;
} else {
$test = getimagesize($arquivoTmp);
$image_type = $test[2];
}
if (in_array($image_type, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP))) {
$image = new SimpleImage();
$image->load($arquivoTmp);
$l = $image->getWidth();
$h = $image->getHeight();
if ($l > $h) {
$funcao = "resizeToWidth";
$novoTamanho = 1024;
} else {
$funcao = "resizeToHeight";
$novoTamanho = 768;
}
$image->$funcao($novoTamanho);
$copiou = $image->save($this->diretorio . $nome);
if ($this->prefixoMarcaDagua) {
$image->$funcao(300);
$image->watermark();
$image->save($this->diretorio . $this->prefixoMarcaDagua . $nome);
}
if ($this->prefixoMiniatura) {
$image->load($arquivoTmp);
$image->$funcao(380);
$image->save($this->diretorio . $this->prefixoMiniatura . $nome);
}
} else {
$copiou = copy($arquivoTmp, $this->diretorio . $nome);
}
if ($copiou) {
$sql = "update $this->tabela set $this->campoBD = '$nome' where id='$idGravado'";
#$altualizaNome = mysql_query($sql) or die($sql . mysql_error);
$this->conexao->executeQuery($sql);
}
} else {
return false;
}
return $idGravado;
}
示例3: base64ToLocalImage
private static function base64ToLocalImage($img, $path, $lim = false, $saveas = '', $quality = 75)
{
$imgdata = base64_decode($img);
if (!!$imgdata) {
require_once 'Master/base/libraries/Images/SimpleImage.php';
$str = str_replace('data:', '', $img);
$arr = explode(';', $str);
$type = $arr[0];
$data = str_replace('base64,', '', $arr[1]);
$data = base64_decode($data);
$ext = static::getExt($type);
if (!!$data && !!$ext) {
$name = !!$saveas ? $saveas : Bella::createId(32);
$name .= $ext;
$file = $path . $name;
$save = @file_put_contents($file, $data);
if (!!$save) {
$sm = new SimpleImage();
$sm->load($file);
$w = $sm->getWidth();
$h = $sm->getHeight();
$minWidth = static::MIN_WIDTH;
$minHeight = static::MIN_HEIGHT;
$maxWidth = static::MAX_WIDTH;
$maxHeight = static::MAX_HEIGHT;
if (!!$lim) {
if (isset($lim['minWidth'])) {
$minWidth = $lim['minWidth'];
}
if (isset($lim['minHeight'])) {
$minHeight = $lim['minHeight'];
}
if (isset($lim['maxWidth'])) {
$maxWidth = $lim['maxWidth'];
}
if (isset($lim['maxHeight'])) {
$maxHeight = $lim['maxHeight'];
}
}
if ($w < $minWidth || $h < $minHeight) {
unlink($file);
return false;
}
if ($w > $maxWidth || $h > $maxHeight) {
$sm->fillTo($maxWidth, $maxHeight);
$sm->save($file, false, $quality);
}
return $name;
}
}
}
}
示例4: upload
function upload()
{
if (!isset($_FILES['upload'])) {
$this->directrender('S3/S3');
return;
}
global $params;
// Params to vars
$client_id = '1b5cc674ae2f335';
// Validations
$this->startValidations();
$this->validate($_FILES['upload']['error'] === 0, $err, 'upload error');
$this->validate($_FILES['upload']['size'] <= 10 * 1024 * 1024, $err, 'size too large');
// Code
if ($this->isValid()) {
$fname = $_FILES['upload']['tmp_name'];
require_once $GLOBALS['dirpre'] . 'includes/S3/SimpleImage.php';
$image = new SimpleImage();
$this->validate($image->load($fname), $err, 'invalid image type');
if ($this->isValid()) {
if ($image->getHeight() > 1000) {
$image->resizeToHeight(1000);
}
$image->save($fname);
function getMIME($fname)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $fname);
finfo_close($finfo);
return $mime;
}
$filetype = explode('/', getMIME($fname));
$valid_formats = array("jpg", "png", "gif", "jpeg");
$this->validate($filetype[0] === 'image' and in_array($filetype[1], $valid_formats), $err, 'invalid image type');
if ($this->isValid()) {
require_once $GLOBALS['dirpre'] . 'includes/S3/s3_config.php';
//Rename image name.
$actual_image_name = time() . "." . $filetype[1];
$this->validate($s3->putObjectFile($fname, $bucket, $actual_image_name, S3::ACL_PUBLIC_READ), $err, 'upload failed');
if ($this->isValid()) {
$reply = "https://{$bucket}.s3.amazonaws.com/{$actual_image_name}";
$this->success('image successfully uploaded');
$this->directrender('S3/S3', array('reply' => "up(\"{$reply}\");"));
return;
}
}
}
}
$this->error($err);
$this->directrender('S3/S3');
}
示例5: bindImage
public function bindImage($elementName)
{
$file = JRequest::getVar($elementName, '', 'FILES');
if (!isset($file['tmp_name']) || empty($file['tmp_name'])) {
return false;
}
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');
// @task: Test if the folder containing the badges exists
if (!JFolder::exists(DISCUSS_BADGES_PATH)) {
JFolder::create(DISCUSS_BADGES_PATH);
}
// @task: Test if the folder containing uploaded badges exists
if (!JFolder::exists(DISCUSS_BADGES_UPLOADED)) {
JFolder::create(DISCUSS_BADGES_UPLOADED);
}
require_once DISCUSS_CLASSES . '/simpleimage.php';
$image = new SimpleImage();
$image->load($file['tmp_name']);
if ($image->getWidth() > 64 || $image->getHeight() > 64) {
return false;
}
$storage = DISCUSS_BADGES_UPLOADED;
$name = md5($this->id . DiscussHelper::getDate()->toMySQL()) . $image->getExtension();
// @task: Create the necessary path
$path = $storage . '/' . $this->id;
if (!JFolder::exists($path)) {
JFolder::create($path);
}
// @task: Copy the original image into the storage path
JFile::copy($file['tmp_name'], $path . '/' . $name);
// @task: Resize to the 16x16 favicon
$image->resize(DISCUSS_BADGES_FAVICON_WIDTH, DISCUSS_BADGES_FAVICON_HEIGHT);
$image->save($path . '/' . 'favicon_' . $name);
$this->avatar = $this->id . '/' . $name;
$this->thumbnail = $this->id . '/' . 'favicon_' . $name;
return $this->store();
}
示例6: die
if (!in_array($fileExt, $typesArray)) {
die("error_filetype_not_allowed");
}
$relative_folder_path = "files/" . gmdate("Y-m") . "/images";
$absolute_folder_path = str_replace('//', '/', "{$_SESSION["root_path"]}/{$relative_folder_path}");
if (!is_dir($absolute_folder_path)) {
mkdir($absolute_folder_path, 0755, true);
}
$random_fileNumber = gmdate("U_") . rand(0, 1000);
$filename = "{$random_fileNumber}__{$user->username}___{$fileParts['basename']}";
$file_absolute_path_fullsize = "{$absolute_folder_path}/{$filename}";
$file_absolute_path_thumbnail = "{$absolute_folder_path}/tn_{$filename}";
$file_relative_path_fullsize = "{$relative_folder_path}/{$filename}";
$file_relative_path_thumbnail = "{$relative_folder_path}/tn_{$filename}";
copy($_FILES['Filedata']['tmp_name'], $file_absolute_path_thumbnail);
move_uploaded_file($_FILES['Filedata']['tmp_name'], $file_absolute_path_fullsize);
$img = new SimpleImage();
$img->load($file_absolute_path_thumbnail);
$filetype = $img->image_type;
if ($img->getWidth() > $img->getHeight()) {
$img->resizeToWidth(150);
} else {
$img->resizeToHeight(150);
}
$img->save($file_absolute_path_thumbnail, $filetype);
$group = $_REQUEST["group"];
$created = gmdate("Y-m-d H:i:s");
if (!mysql_query("INSERT INTO `images_general` (`type`,`size`,`file_location`,`file_thumbnail`,`file_name`,`group`,`author`,`created`) VALUES ('{$fileExt}','" . filesize($_FILES['Filedata']['tmp_name']) . "','{$file_relative_path_fullsize}','{$file_relative_path_thumbnail}','{$fileParts['basename']}','{$group}','{$user->username}','{$created}')")) {
die("database_error");
}
die("done");
示例7: mkdir
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/rb72aknjykn0w5cefu6z3g7yw8xnpa/';
$targetFile = str_replace('//', '/', $targetPath) . $file;
$name = $_FILES['Filedata']['name'];
error_reporting(0);
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES['Filedata']['name']);
// if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
mkdir(str_replace('//', '/', $targetPath), 0755, true);
move_uploaded_file($tempFile, $targetFile);
$image = new SimpleImage();
$image->load($targetFile);
if ($image->getWidth() > 600 || $image->getHeight() > 450) {
//set proper width
if ($image->getWidth() > 600) {
$image->resizeToWidth(600);
}
//set proper height
if ($image->getHeight() > 450) {
$image->resizeToHeight(450);
}
$image->save($targetFile, IMAGETYPE_JPEG, 75, 0755);
$newFile = str_replace('//', '/', $targetPath) . 'thumb_' . $file;
$image->resize(155, 115);
$image->save($newFile, IMAGETYPE_JPEG, 75, 0755);
} else {
$image->save($targetFile, IMAGETYPE_JPEG, 75, 0755);
$newFile = str_replace('//', '/', $targetPath) . 'thumb_' . $file;
示例8: mkdir
mkdir(AT_PA_CONTENT_DIR . $album_file_path_tn);
}
//add the photo
$added_photo_id = $pa->addPhoto($_FILES['photo']['name'], $_POST['photo_comment'], $_SESSION['member_id']);
if ($added_photo_id <= 0) {
$msg->addError('PA_ADD_PHOTO_FAILED');
}
if (!$msg->containsErrors()) {
//get photo filepath
$photo_info = $pa->getPhotoInfo($added_photo_id);
$photo_file_path = getPhotoFilePath($added_photo_id, $_FILES['photo']['name'], $photo_info['created_date']);
//resize images to a specific size, and its thumbnail
$si = new SimpleImage();
$si->load($_FILES['photo']['tmp_name']);
$image_w = $si->getWidth();
$image_h = $si->getHeight();
//picture is horizontal
if ($image_w > $image_h) {
//don't stretch images
if ($image_w > AT_PA_IMAGE) {
$si->resizeToWidth(AT_PA_IMAGE);
$si->save(AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path);
} else {
move_uploaded_file($_FILES['photo']['tmp_name'], AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path);
}
$si->resizeToWidth(AT_PA_IMAGE_THUMB);
$si->save(AT_PA_CONTENT_DIR . $album_file_path_tn . $photo_file_path);
} else {
if ($image_h > AT_PA_IMAGE) {
$si->resizeToHeight(AT_PA_IMAGE);
$si->save(AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path);
示例9: SimpleImage
$strFirstName = $row["first_name"];
$strLastName = $row["last_name"];
$strPhone = $row["cellphone"];
$intverification_id = $row["verification_id"];
}
//make thumbnail if it is an image...?
$strExtension = get_extension($strFileName);
//name is filename of uploaded file
if ($strExtension == "jpg" or $strExtension == "jpeg" or $strExtension == "png" or $strExtension = "gif") {
//save thumbbail - [BUG] thumbnails are being rotated... ????
$imageThumbPath = PICTURETHUMBPATH . $strKeyLink . ".jpg";
$image = new SimpleImage();
//init object
$image->load($uploaded_file);
$width = $image->getWidth();
$height = $image->getHeight();
//$image->resize(100,100); //rescale
$image->resizeToWidth(200);
//we want to instead save it with proportions intact...
$image->save(__ROOT__ . $imageThumbPath);
}
if ($strExtension == "pdf") {
$strCopyExt = "pdf";
} else {
$strCopyExt = "jpg";
}
//send admin an email on upload
if ($strFromPage == "receipts") {
//get crypto rate
$intCryptoRate = funct_Billing_GetRate();
if ($dateFirstreceiptUpload == 0) {
示例10: basename
$item = 'picture_file_' . $i;
if (isset($_FILES[$item])) {
$target_path = '/tmp/';
$target_path = $target_path . basename($_FILES[$item]['name']);
// Mime Type Check
$mime = mime_content_type($_FILES[$item]['tmp_name']);
$accepted_mimes = array('image/jpeg', 'image/gif', 'image/png');
if (!in_array($mime, $accepted_mimes)) {
array_push($errors, 'You attempted to upload an unsupported image type, or you did not select an image. Please try uploading a JPEG, PNG or GIF.');
}
if (count($errors) == 0) {
if (move_uploaded_file($_FILES[$item]['tmp_name'], $target_path)) {
//bookmark
$resizeimage = new SimpleImage();
$resizeimage->load($target_path);
if ($resizeimage->getWidth() > $resizeimage->getHeight()) {
if ($resizeimage->getWidth() > 800) {
$resizeimage->resizeToWidth(800);
}
} else {
if ($resizeimage->getHeight() > 800) {
$resizeimage->resizeToHeight(800);
}
}
$resizeimage->save($target_path);
$ext = substr($target_path, strpos($target_path, ".") + 1);
$ext = str_replace(".", "", $ext);
$name = $meta['experiment_id'] . '_' . $session->userid . '_' . time() . '_' . $i . '.' . $ext;
$s3->putObjectFile($target_path, AWS_IMG_BUCKET, $name, S3::ACL_PUBLIC_READ);
$provider_url = $url . '/' . $name;
createImageItemWithSessionId($session->userid, $meta['experiment_id'], $sid, "iSENSE - " . $vtitle, $description, 'Amazon S3', $name, $provider_url, AWS_IMG_BUCKET, 1);
示例11: handleUpload
/**
* Returns array('success'=>true) or array('error'=>'error message')
*/
function handleUpload($uploadDirectory, $replaceOldFile = FALSE)
{
$folder = getcwd() . '/uploads/';
$thumbFolder = getcwd() . '/uploads/thumbs/';
if (!is_writable($uploadDirectory)) {
return array('error' => "Server error. Upload directory isn't writable.");
}
if (!$this->file) {
return array('error' => 'No files were uploaded.');
}
$size = $this->file->getSize();
if ($size == 0) {
return array('error' => 'File is empty');
}
if ($size > $this->sizeLimit) {
return array('error' => 'File is too large');
}
$pathinfo = pathinfo($this->file->getName());
$filename = $pathinfo['filename'];
//$filename = md5(uniqid());
$ext = $pathinfo['extension'];
if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) {
$these = implode(', ', $this->allowedExtensions);
return array('error' => 'File has an invalid extension, it should be one of ' . $these . '.');
}
if (!$replaceOldFile) {
/// don't overwrite previous files that were uploaded
while (file_exists($uploadDirectory . $filename . '.' . $ext)) {
$filename .= rand(10, 99);
}
}
if ($this->file->save($uploadDirectory . $filename . '.' . $ext)) {
$image = new SimpleImage();
$image->load($folder . $filename . '.' . $ext);
$width = $image->getWidth();
$height = $image->getHeight();
$image->resize(150, 150);
$image->save('uploads/thumbs/' . $filename . '-thumb.' . $ext);
return array('success' => true, 'size' => $size, 'width' => $width, 'height' => $height, 'extension' => $ext, 'file_name' => $filename);
} else {
return array('error' => 'Could not save uploaded file.' . 'The upload was cancelled, or server error encountered');
}
}
示例12: waterMark
/**
* Watermarks an image
*
* @param string $source Watermark image path
* @param string $position Position on image (can be top-left, top right, bottom-right, bottom-left)
*
* @return void
*/
public function waterMark($source, $position = 'bottom-left')
{
// Watermark margins:
$margins = 5;
// Getting the waterMark image:
$w = new SimpleImage();
$w->load($source);
// Getting the watermark position:
switch ($position) {
case 'top-left':
$startX = $margins;
$startY = $margins;
break;
case 'top-right':
$startX = $this->getWidth() - $w->getWidth() - $margins;
$startY = $margins;
break;
case 'bottom-right':
$startX = $this->getWidth() - $w->getWidth() - $margins;
$startY = $this->getHeight() - $w->getHeight() - $margins;
break;
// Bottom left:
// Bottom left:
default:
$startX = $margins;
$startY = $this->getHeight() - $w->getHeight() - $margins;
break;
}
$newImage = $this->currentImage;
imagecopy($newImage, $w->currentImage, $startX, $startY, 0, 0, $w->getWidth(), $w->getHeight());
$this->currentImage = $newImage;
}
示例13: upload
function upload($userid, $max_byte_size = 2097152)
{
global $debug;
global $config;
$dir = 'media/avatar/';
$msg = '';
// upload button has been pressed
if (@$_POST['submit'] == 'Upload') {
// set allowed file types
$allowed_types = "(jpg|jpeg|gif|bmp|png)";
// is really a file?
if (is_uploaded_file($_FILES["file"]["tmp_name"])) {
// valid extension?
if (preg_match("/\\." . $allowed_types . "\$/i", $_FILES["file"]["name"])) {
// file size okay?
if ($_FILES["file"]["size"] <= $max_byte_size) {
// width and height okay?
$size = getimagesize($_FILES['file']['tmp_name']);
$debug->add('img-size', 'height:' . $size[0] . ' width:' . $size[1]);
// get user
$u = $this->user->getUserByID($userid);
$filename = uniqid($u['userid'] . "_") . "_" . $_FILES["file"]["name"];
// everything all right, now copy
if (!file_exists($dir . $filename)) {
if (copy($_FILES["file"]["tmp_name"], $dir . $filename)) {
// Resize image if too large
$image = new SimpleImage();
$image->load($dir . $filename);
if ($image->getWidth() > (int) $config->get('core', 'img-width')) {
$image->resizeToWidth((int) $config->get('core', 'img-width'));
}
if ($image->getHeight() > (int) $config->get('core', 'img-height')) {
$image->resizeToHeight((int) $config->get('core', 'img-height'));
}
// Save image
$this->remove($filename);
$image->save($dir . $filename);
// upload successfull
$msg = $this->lang->get('upload_successfull');
// remove old avatar
$this->remove($u['avatar']);
// update avatar
$this->user->setAvatar($userid, $filename);
} else {
$msg = $this->lang->get('upload_failed');
}
} else {
$msg = $this->lang->get('upload_failed');
}
} else {
$msg = $this->lang->get('upload_too_large');
}
} else {
$msg = $this->lang->get('upload_bad_extension');
}
} else {
$msg = $this->lang->get('upload_failed');
}
}
// display the upload-form
return '
<p>
' . $msg . '
</p>
<form action="" method="post" enctype="multipart/form-data" name="upload">
<input type="file" name="file" />
<input type="submit" name="submit" value="Upload" />
</form>
';
}
示例14: Upload
}
}
}
if ($_FILES['image']['size'] > 0) {
$upload = new Upload();
$upload->dir = 'media/boximages/ad/';
$upload->tag_name = 'image';
$upload->uploadFile();
$imgdir = "./media/boximages/ad/";
include_once './core/simple.image.core.php';
$image = new SimpleImage();
$image->load($imgdir . $upload->file_name);
if ($image->getWidth() > (int) $config->get('ad', 'standard_image_width')) {
$image->resizeToWidth((int) $config->get('ad', 'standard_image_width'));
}
if ($image->getHeight() > (int) $config->get('ad', 'standard_image_height')) {
$image->resizeToHeight((int) $config->get('ad', 'standard_image_height'));
}
unlink($imgdir . $upload->file_name);
$image->save($imgdir . $upload->file_name);
if (substr($_POST['newurl'], 0, 7) != "http://") {
$_POST['newurl'] = "http://" . $_POST['newurl'];
}
$db->insert($tbl_ad, array('img', 'url'), array("'" . $upload->file_name . "'", "'" . $_POST['newurl'] . "'"));
}
}
$allads = $db->selectList($tbl_ad, '*', 1);
$counter = 0;
$ads = array();
foreach ($allads as $ad) {
$ads[$counter] = $ad;
示例15: store
function store($data = null)
{
JRequest::checkToken() or die(JText::_('Invalid Token'));
JRequest::checkToken() or die(JText::_('Invalid Token'));
$auth =& JFactory::getACL();
$auth->addACL('com_artclub', 'store', 'users', 'super administrator');
$auth->addACL('com_artclub', 'store', 'users', 'administrator');
$user =& JFactory::getUser();
if (!$user->authorize('com_artclub', 'store')) {
$this->setError("Not authorized");
return false;
}
if ($data == null) {
$data = JRequest::get('post');
}
$error = $this->validate($data);
if ($error) {
$this->setError($error);
return false;
}
foreach ($data as $key => $val) {
$item->{$key} = $val;
}
foreach ($_FILES as $file) {
if (!$file['name']) {
continue;
}
require_once '../functions.php';
$image = new SimpleImage();
$image->load($file['tmp_name']);
$w = $image->getWidth();
$h = $image->getHeight();
if ($w > $h) {
$image->resizeToWidth(500);
} else {
$image->resizeToHeight(500);
}
$image->save('../images/stories/artwork/' . $file['name'] . '_big.jpg');
if ($w > $h) {
$image->resizeToWidth(200);
} else {
$image->resizeToHeight(200);
}
$image->save('../images/stories/artwork/' . $file['name'] . '_med.jpg');
$item->filename = $file['name'];
}
if (array_key_exists('allocatedimagename', $_REQUEST)) {
$allocated = JRequest::getVar('allocatedimagename', NULL, 'post', 'path');
if ($allocated) {
$allocated = JPATH_BASE . $allocated;
if (file_exists($allocated)) {
$new = str_replace('thumb200_', '', $allocated) . '_med.jpg';
$new = str_replace('/tmp/', '/images/stories/artwork/', $new);
rename($allocated, $new);
$allocated = str_replace('200_', '500_', $allocated);
$new = str_replace('thumb500_', '', $allocated) . '_big.jpg';
$new = str_replace('/tmp/', '/images/stories/artwork/', $new);
rename($allocated, $new);
$allocated = str_replace('thumb500_', '', $allocated);
$item->filename = basename($allocated);
unlink($allocated);
}
}
}
$row =& $this->getTable();
// Bind the form fields to the table
if (!$row->bind($item)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Make sure the record is valid
if (!$row->check()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
// Store the table to the database
if (!$row->store()) {
$this->setError($this->_db->getErrorMsg());
return false;
}
return true;
}