當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Brand::updateLogo方法代碼示例

本文整理匯總了PHP中Brand::updateLogo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Brand::updateLogo方法的具體用法?PHP Brand::updateLogo怎麽用?PHP Brand::updateLogo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Brand的用法示例。


在下文中一共展示了Brand::updateLogo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addLogo

 function addLogo(Brand $Brand)
 {
     if (isset($_FILES['fileLogoURL']) && $_FILES['fileLogoURL']['size'] > 0) {
         $errors = array();
         $fileName = $_FILES['fileLogoURL']['name'];
         $tmpName = $_FILES['fileLogoURL']['tmp_name'];
         $fileSize = $_FILES['fileLogoURL']['size'];
         $fileType = $_FILES['fileLogoURL']['type'];
         $File = new File($fileName, $tmpName, $fileSize, $fileType);
         if ($fileSize > 2097152) {
             $errors[] = 'File phải nhỏ hơn 2 MB';
         }
         if (!$File->isImageType()) {
             $errors[] = "";
         }
         if (empty($errors) == true) {
             //remove Logo old
             $logo_Old = trim($Brand->getLogoURL(), '"');
             if (file_exists($logo_Old)) {
                 unlink($logo_Old);
             }
             //Add logo new
             $path = '../assets/images/logoBrands/' . $Brand->getBraID();
             if (!file_exists($path)) {
                 // neu k ton tai duong dan thu muc cua id nay thi tạo mới
                 File::createDirectory($path);
             }
             $type = explode("/", $File->getFileType())[1];
             $find = array(" ", "\\", "/", ":", "*", "?", "\"", "<", ">", "|");
             $name = File::utf8convert(str_replace($find, '', $Brand->getBraName()));
             $pathNew = $path . '/logo_' . $name . "." . $type;
             $File->moveFile($pathNew);
             $Brand->setLogoURL($pathNew);
             $Brand->updateLogo();
         } else {
             //print_r($errors);
         }
         if (empty($error)) {
             //echo "Success";
         }
     }
 }
開發者ID:luvyatyss,項目名稱:nashop,代碼行數:42,代碼來源:brands.php

示例2: Brand

<?php

if (Tools::P('sveBrand') == 'add') {
    $brand = new Brand();
    $brand->copyFromPost();
    if ($brand->add() && $brand->updateLogo()) {
        UIAdminAlerts::conf('品牌已更新');
    }
    if (is_array($brand->_errors) and count($brand->_errors) > 0) {
        $errors = $brand->_errors;
    }
}
if (isset($_GET['id'])) {
    $id = (int) Tools::G('id');
    $obj = new Brand($id);
}
if (isset($_POST['sveBrand']) && Tools::P('sveBrand') == 'edit') {
    if (Validate::isLoadedObject($obj)) {
        $obj->copyFromPost();
        if ($obj->update() && $obj->updateLogo()) {
            if (!isset($_FILES['qqfile']['name']) || isset($_FILES['qqfile']['name']) && $obj->updateLogo()) {
                UIAdminAlerts::conf('品牌已更新');
            }
        }
    }
    if (is_array($obj->_errors) and count($obj->_errors) > 0) {
        $errors = $obj->_errors;
    }
}
if (isset($errors)) {
    UIAdminAlerts::MError($errors);
開發者ID:yiuked,項目名稱:tmcart,代碼行數:31,代碼來源:brand_edit.php


注:本文中的Brand::updateLogo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。