本文整理匯總了PHP中ImageHelper::deleteFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageHelper::deleteFile方法的具體用法?PHP ImageHelper::deleteFile怎麽用?PHP ImageHelper::deleteFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ImageHelper
的用法示例。
在下文中一共展示了ImageHelper::deleteFile方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: RemoveFileOnly
public static function RemoveFileOnly($pk, $fieldName)
{
$modelRemove = self::model()->findByPk($pk);
if (is_null($modelRemove) || empty($modelRemove->{$fieldName})) {
return;
}
$aDate = explode('-', $modelRemove->date_only);
$pathUpload = ProGlobalEnquiry::$folderUpload . "/{$aDate['0']}/{$aDate['1']}/{$aDate['2']}";
$ImageHelper = new ImageHelper();
$ImageHelper->folder = '/' . $pathUpload;
$ImageHelper->deleteFile($ImageHelper->folder . '/' . $modelRemove->{$fieldName});
}
示例2: deleteImage
public function deleteImage($fieldName, $path, $oldImage)
{
if (!empty($oldImage)) {
ImageHelper::deleteFile($path . '/' . $oldImage);
if (array_key_exists($fieldName, $this->aImageSize) && is_array($this->aImageSize[$fieldName])) {
$aSize = $this->aImageSize[$fieldName];
foreach ($aSize as $key => $value) {
ImageHelper::deleteFile($path . '/' . $key . '/' . $oldImage);
}
}
}
}
示例3: actionEdit
/**
* Displays a particular model.
* @param integer $id the ID of the model to be displayed
*/
public function actionEdit()
{
if (!empty($this->catalog)) {
$message = "";
$catalog = $this->catalog;
$action = Yii::app()->request->getParam("action", "");
if ($this->id) {
$item = $catalog::fetch($this->id);
} else {
$item = new $catalog();
}
// Удаление картинки
if ($action == "img_del") {
$imageField = Yii::app()->request->getParam("field", "");
if (!empty($imageField)) {
ImageHelper::deleteFile($item, $imageField);
$item->save();
$message = "Фото успешно удаленно";
}
}
// Удаляем картинки в галлере
if ($action == "gal_del") {
$id = (int) Yii::app()->request->getParam("img_id", 0);
if (!empty($id)) {
$imageModel = CatGallery::fetch($id);
if ($imageModel->id > 0) {
$imageModel->delete();
$message = "Фото успешно удаленно";
}
}
}
$addGallery = new CatGallery();
if ($item->id > 0) {
$listImage = CatGallery::fetchAll(DBQueryParamsClass::CreateParams()->setConditions("catalog=:catalog AND item_id=:item_id")->setParams(array(":catalog" => $item->tableName(), ":item_id" => $item->id))->setOrderBy("pos, id")->setCache(0)->setLimit(-1));
} else {
$listImage = array();
}
$this->arrayParams["catalog"] = $catalog;
$this->render('edit', array('arrayParams' => $this->arrayParams, 'controller' => $this, 'form' => $item, 'catalog' => SiteHelper::getCamelCase($item->tableName()), 'listImage' => $listImage, 'message' => $message, 'addGallery' => $addGallery));
}
}
示例4: RemoveFileOnly
public static function RemoveFileOnly($pk, $fieldName, $aSize)
{
$modelRemove = self::model()->findByPk($pk);
if (is_null($modelRemove) || empty($modelRemove->{$fieldName})) {
return;
}
$pathUpload = ProInventoryPhoto::$folderUpload;
$ImageHelper = new ImageHelper();
$ImageHelper->folder = '/' . $pathUpload;
$ImageHelper->deleteFile($ImageHelper->folder . '/' . $modelRemove->{$fieldName});
foreach ($aSize as $key => $value) {
$ImageHelper->deleteFile($ImageHelper->folder . '/' . $key . '/' . $modelRemove->{$fieldName});
}
}
示例5: deleteImage
public static function deleteImage($model)
{
$model = self::model()->findByPk($model->id);
if (is_null($model) || empty($model->photo)) {
return;
}
$ImageHelper = new ImageHelper();
$ImageHelper->folder = '/' . self::$folderUpload . '/' . $model->id;
$ImageHelper->deleteFile($ImageHelper->folder . '/' . $model->photo);
}
示例6:
$mUser->scenario = null;
$mUser->agent_company_name = $model->company_name;
$mUser->first_name = $model->salesperson_name;
if (trim($mUser->first_name) == '' && $model->type == ProTransactionsBillTo::TYPE_VENDOR_PURCHASER) {
$mUser->first_name = $model->attn_to;
}
$mUser->nric_passportno_roc = $model->nric_no;
$mUser->contact_no = $model->contact_no;
$mUser->address = $model->billing_address;
$mUser->postal_code = $model->postal_code;
$mUser->status = STATUS_INACTIVE;
$mUser->application_id = FE;
$mUser->role_id = $role_id;