本文整理汇总了PHP中FileUpload::resampleImage方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUpload::resampleImage方法的具体用法?PHP FileUpload::resampleImage怎么用?PHP FileUpload::resampleImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUpload
的用法示例。
在下文中一共展示了FileUpload::resampleImage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: FileUpload
function m_updateCompInfo()
{
if (!isset($this->request['bill_state_id']) || empty($this->request['bill_state_id'])) {
$this->request['bill_state_id'] = "";
} else {
$this->request['bill_state'] = "";
}
#FILE UPLOADING START
if ($this->libFunc->checkImageUpload("image1") && $_FILES["image1"]["tmp_name"] != "") {
$fileUpload = new FileUpload();
$fileUpload->source = $_FILES["image1"]["tmp_name"];
$fileUpload->target = $this->imagePath . "company/" . $_FILES["image1"]["name"];
$newName1 = $fileUpload->upload();
$fileUpload->resampleImage($this->imagePath . "company/" . $newName1, 250, 250, 100);
// [/DRK]
if ($newName1 != false) {
$image1 = $newName1;
}
} else {
$this->obDb->query = "SELECT vLogo FROM " . COMPANYSETTINGS;
$logo = $this->obDb->fetchQuery();
$image1 = $logo[0]->vLogo;
}
#INSERTING COMPANY DETAILS
$this->obDb->query = "UPDATE " . COMPANYSETTINGS . " SET \n\t\tvCname ='" . $this->libFunc->m_addToDB($this->request['storeName']) . "',\n\t\tvAddress ='" . $this->libFunc->m_addToDB($this->request['storeAddress']) . "',\n\t\tvCity ='" . $this->libFunc->m_addToDB($this->request['storeCity']) . "',\n\t\tvState='" . $this->libFunc->m_addToDB($this->request['bill_state_id']) . "',\n\t\tvStateName='" . $this->libFunc->m_addToDB($this->request['bill_state']) . "',\n\t\tvCountry='" . $this->libFunc->m_addToDB($this->request['bill_country_id']) . "',\n\t\tvZip='" . $this->libFunc->m_addToDB($this->request['storeZip']) . "',\n\t\tvFax ='" . $this->libFunc->m_addToDB($this->request['storeFax']) . "',\n\t\tvPhone ='" . $this->libFunc->m_addToDB($this->request['storePhone']) . "',\n\t\tvFreePhone ='" . $this->libFunc->m_addToDB($this->request['storeTollFree']) . "',\n\t\tvVatNumber ='" . $this->libFunc->m_addToDB($this->request['vatNumber']) . "',\n\t\tvRNumber ='" . $this->libFunc->m_addToDB($this->request['companyNumber']) . "',\n\t\tvSlogan ='" . $this->libFunc->m_addToDB($this->request['companySlogan']) . "',\n\t\tvLogo ='" . $image1 . "'";
$this->obDb->updateQuery();
$this->libFunc->m_mosRedirect(SITE_URL . "admin/adminindex.php?action=settings.company&msg=1");
}
示例2: FileUpload
function m_uploadImage()
{
$fileUpload = new FileUpload();
if ($this->request['type'] == "product") {
$this->obDb->query = "SELECT iProdid_PK,vTitle,vImage1,vImage2,vImage3,tImages,vDownloadablefile ";
$this->obDb->query .= " FROM " . PRODUCTS . " where iProdid_PK ='" . $this->request['id'] . "'";
$this->imagePath = $this->imagePath . "product/";
} elseif ($this->request['type'] == "content") {
$this->obDb->query = "SELECT iContentId_PK,vTitle,vImage1,vImage2,vImage3 FROM " . CONTENTS;
$this->obDb->query .= " WHERE iContentId_PK ='" . $this->request['id'] . "'";
$this->imagePath = $this->imagePath . "content/";
} else {
$this->obDb->query = "SELECT iDeptId_PK,vTitle,vImage1,vImage2,vImage3 FROM " . DEPARTMENTS;
$this->obDb->query .= " WHERE iDeptId_PK ='" . $this->request['id'] . "'";
$this->imagePath = $this->imagePath . "department/";
}
$rsImage = $this->obDb->fetchQuery();
if ($this->libFunc->checkImageUpload("image1")) {
if (is_file($this->imagePath . $rsImage[0]->vImage1)) {
$fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage1);
}
$fileUpload->source = $_FILES["image1"]["tmp_name"];
$fileUpload->target = $this->imagePath . $_FILES["image1"]["name"];
$newName1 = $fileUpload->upload();
if ($newName1 != false) {
$image1 = $newName1;
//
if ($this->libFunc->ifSet($this->request, "resample")) {
// This section is used by product, dept and content:
switch ($this->request['type']) {
case "product":
$fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_SMIMAGEWIDTH, UPLOAD_SMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
break;
case "dept":
$fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_DEPTSMIMAGEWIDTH, UPLOAD_DEPTSMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
break;
case "content":
$fileUpload->resampleImage($this->imagePath . $newName1, UPLOAD_CONTENTSMIMAGEWIDTH, UPLOAD_CONTENTSMIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
break;
}
}
// [/DRK]
}
$imagename = "image1";
} else {
$image1 = $rsImage[0]->vImage1;
$imagename = $this->request['current_image'];
}
if ($this->libFunc->checkImageUpload("image2")) {
if (is_file($this->imagePath . $rsImage[0]->vImage2)) {
$fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage2);
}
$fileUpload->source = $_FILES["image2"]["tmp_name"];
$fileUpload->target = $this->imagePath . $_FILES["image2"]["name"];
$newName2 = $fileUpload->upload();
if ($newName2 != false) {
$image2 = $newName2;
//
if ($this->libFunc->ifSet($this->request, "resample")) {
// This section is used by product and dept:
switch ($this->request['type']) {
case "product":
$fileUpload->resampleImage($this->imagePath . $newName2, UPLOAD_MDIMAGEWIDTH, UPLOAD_MDIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
break;
case "dept":
$fileUpload->resampleImage($this->imagePath . $newName2, UPLOAD_DEPTMDIMAGEWIDTH, UPLOAD_DEPTMDIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
break;
}
}
// [/DRK]
}
$imagename = "image2";
} else {
$image2 = $rsImage[0]->vImage2;
$imagename = $this->request['current_image'];
}
if ($this->libFunc->checkImageUpload("image3")) {
if (is_file($this->imagePath . $rsImage[0]->vImage3)) {
$fileUpload->deleteFile($this->imagePath . $rsImage[0]->vImage3);
}
$fileUpload->source = $_FILES["image3"]["tmp_name"];
$fileUpload->target = $this->imagePath . $_FILES["image3"]["name"];
$newName3 = $fileUpload->upload();
if ($newName3 != false) {
$image3 = $newName3;
if ($this->libFunc->ifSet($this->request, "resample")) {
$fileUpload->resampleImage($this->imagePath . $newName3, UPLOAD_LGIMAGEWIDTH, UPLOAD_LGIMAGEHEIGHT, UPLOAD_JPGCOMPRESSION);
}
}
$imagename = "image3";
} else {
$image3 = $rsImage[0]->vImage3;
$imagename = $this->request['current_image'];
}
if ($this->request['type'] == "product") {
if ($this->libFunc->checkFileUpload("image4")) {
if (is_file($this->imagePath . "../files/" . $rsImage[0]->vDownloadablefile)) {
$fileUpload->deleteFile($this->imagePath . "../files/" . $rsImage[0]->vDownloadablefile);
}
$fileUpload->source = $_FILES["image4"]["tmp_name"];
//.........这里部分代码省略.........