当前位置: 首页>>代码示例>>PHP>>正文


PHP QApplication::MoveToS3方法代码示例

本文整理汇总了PHP中QApplication::MoveToS3方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::MoveToS3方法的具体用法?PHP QApplication::MoveToS3怎么用?PHP QApplication::MoveToS3使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QApplication的用法示例。


在下文中一共展示了QApplication::MoveToS3方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ProcessUpload

 /**
  * Save the uploaded file to the file system
  *
  */
 public function ProcessUpload()
 {
     if (strpos($this->strType, "image") !== false) {
         move_uploaded_file($this->strFile, $this->strUploadPath . $this->strFileName);
         if ($this->boolBuildThumbs) {
             $this->CreateThumbnail($this->strUploadPath . $this->strFileName, $this->strThumbUploadPath . $this->strThumbPrefix . $this->strFileName, $this->intThumbWidth, $this->intThumbHeight, $this->intThumbQuality);
         }
     }
     if (AWS_S3) {
         QApplication::MoveToS3($this->strUploadPath, $this->strFileName, $this->strType, '/images/asset_models');
         if ($this->boolBuildThumbs) {
             if (file_exists($this->strThumbUploadPath . $this->strFileName)) {
                 QApplication::MoveToS3($this->strThumbUploadPath, $this->strFileName, $this->strType, '/images/asset_models/thumbs');
             }
         }
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:21,代码来源:QImageFileControl.class.php

示例2: dlgFileAsset_Upload

 public function dlgFileAsset_Upload()
 {
     // This is from QFileAssetBase.class.php, with only adding a period to the regular expression below to allow for files like test.class.php
     // This will be reported to Mike Ho and hopefully put in the core.
     // File Not Uploaded
     if (!file_exists($this->dlgFileAsset->flcFileAsset->File) || !$this->dlgFileAsset->flcFileAsset->Size) {
         $this->dlgFileAsset->ShowError($this->strUnacceptableMessage);
         // File Has Incorrect MIME Type (only if an acceptiblemimearray is setup)
     } else {
         if (is_array($this->strAcceptibleMimeArray) && !array_key_exists($this->dlgFileAsset->flcFileAsset->Type, $this->strAcceptibleMimeArray)) {
             $this->dlgFileAsset->ShowError($this->strUnacceptableMessage);
             // File Successfully Uploaded
         } else {
             // Setup Filename, Base Filename and Extension
             $strFilename = $this->dlgFileAsset->flcFileAsset->FileName;
             $intPosition = strrpos($strFilename, '.');
             if (is_array($this->strAcceptibleMimeArray) && array_key_exists($this->dlgFileAsset->flcFileAsset->Type, $this->strAcceptibleMimeArray)) {
                 $strExtension = $this->strAcceptibleMimeArray[$this->dlgFileAsset->flcFileAsset->Type];
             } else {
                 if ($intPosition) {
                     $strExtension = substr($strFilename, $intPosition + 1);
                     $strExtension = strtolower($strExtension);
                     $strBaseFilename = substr($strFilename, 0, $intPosition);
                 } else {
                     $strExtension = null;
                     $strBaseFilename = $strFilename;
                 }
             }
             // Save the File in a slightly more permanent temporary location
             $strTempFilePath = $this->strTemporaryUploadPath . '/' . basename($this->dlgFileAsset->flcFileAsset->File) . rand(1000, 9999) . '.' . $strExtension;
             copy($this->dlgFileAsset->flcFileAsset->File, $strTempFilePath);
             $this->File = $strTempFilePath;
             // Cleanup and Save Filename
             $this->strFileName = preg_replace('/[^A-Z^a-z^0-9_\\-.]/', '', $strBaseFilename);
             if ($strExtension) {
                 $this->strFileName .= '.' . $strExtension;
             }
             // Hide the Dialog Box
             $this->dlgFileAsset->HideDialogBox();
             // Refresh Thyself
             $this->Refresh();
         }
     }
     if (!file_exists($this->dlgFileAsset->flcFileAsset->File) || !$this->dlgFileAsset->flcFileAsset->Size) {
         if ($this->dlgFileAsset->flcFileAsset->Error == 1 || $this->dlgFileAsset->flcFileAsset->Error == 2) {
             $this->dlgFileAsset->ShowError("The filesize is too large. File must be under 10MB");
         } else {
             $this->dlgFileAsset->ShowError("That is an unacceptable file");
         }
     } else {
         $objAttachment = new Attachment();
         $objAttachment->EntityQtypeId = $this->intEntityQtypeId;
         $objAttachment->EntityId = $this->intEntityId;
         $objAttachment->Filename = $this->FileName;
         $arrPath = array_reverse(explode("\\", $this->File));
         if (count($arrPath) <= 1) {
             $arrPath = array_reverse(explode("/", $this->File));
         }
         $objAttachment->TmpFilename = $arrPath[0];
         $objAttachment->FileType = $this->dlgFileAsset->flcFileAsset->Type;
         $objAttachment->Path = $this->File;
         $objAttachment->Size = filesize($this->File);
         // do not upload same file by the same user
         $duplicate_file = false;
         $existing_attachments = Attachment::LoadArrayByEntityQtypeIdEntityId($this->intEntityQtypeId, $this->intEntityId);
         if (count($existing_attachments)) {
             foreach ($existing_attachments as $existing_attachment) {
                 if ($existing_attachment->EntityQtypeId == $this->intEntityQtypeId && $existing_attachment->EntityId == $this->intEntityId && $existing_attachment->Filename == $this->FileName && $existing_attachment->FileType == $this->dlgFileAsset->flcFileAsset->Type && $existing_attachment->Size == filesize($this->File) && $existing_attachment->CreatedBy == QApplication::$objUserAccount->UserAccountId) {
                     $duplicate_file = true;
                 }
             }
         }
         if (!$duplicate_file) {
             $objAttachment->Save();
             if (AWS_S3) {
                 QApplication::MoveToS3(__DOCROOT__ . __SUBDIRECTORY__ . '/uploads/attachments', $objAttachment->TmpFilename, $objAttachment->FileType, '/attachments');
                 $objAttachment->Path = 'http://s3.amazonaws.com/' . AWS_BUCKET . AWS_PATH . '/attachments/' . $objAttachment->TmpFilename;
                 $objAttachment->Save();
             }
         }
         if ($this->objParentControl) {
             $this->objParentControl->pnlAttachments_Create();
         } else {
             $this->objForm->pnlAttachments_Create();
         }
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:87,代码来源:QAttach.class.php

示例3: btnSave_Click

 protected function btnSave_Click()
 {
     $this->pnlSaveNotification->Display = false;
     QApplication::$TracmorSettings->MinAssetCode = $this->txtMinAssetCode->Text;
     // Make sure a valid number is entered for Search Results Per Page setting
     if (!is_numeric(trim($this->txtSearchResultsPerPage->Text)) || intval(trim($this->txtSearchResultsPerPage->Text)) < 1) {
         $this->txtSearchResultsPerPage->Warning = QApplication::Translate('Please enter a valid number');
         $this->txtSearchResultsPerPage->Blink();
         $this->txtSearchResultsPerPage->Focus();
         return;
     } else {
         QApplication::$TracmorSettings->SearchResultsPerPage = intval(trim($this->txtSearchResultsPerPage->Text));
     }
     // If a customer logo was uploaded, save it to the appropriate location
     if ($this->flaCompanyLogo->File) {
         $arrImageInfo = getimagesize($this->flaCompanyLogo->File);
         // Resize the image if necessary
         $strMimeType = image_type_to_mime_type($arrImageInfo[2]);
         $intSrcWidth = $arrImageInfo[0];
         $intSrcHeight = $arrImageInfo[1];
         if ($intSrcHeight > 50) {
             $intDstHeight = 50;
             $intDstWidth = round(50 / $intSrcHeight * $intSrcWidth);
             $imgResampled = imagecreatetruecolor($intDstWidth, $intDstHeight);
             $strTransparentColor = imagecolorallocatealpha($imgResampled, 0, 0, 0, 127);
             imagealphablending($imgResampled, false);
             imagefilledrectangle($imgResampled, 0, 0, $intDstWidth, $intDstHeight, $strTransparentColor);
             imagealphablending($imgResampled, true);
             imagesavealpha($imgResampled, true);
             switch ($strMimeType) {
                 case 'image/gif':
                     $image = imageCreateFromGIF($this->flaCompanyLogo->File);
                     break;
                 case 'image/jpeg':
                 case 'image/pjpeg':
                     $image = imageCreateFromJPEG($this->flaCompanyLogo->File);
                     break;
                 case 'image/png':
                 case 'image/x-png':
                     $image = imageCreateFromPNG($this->flaCompanyLogo->File);
                     break;
             }
             imagecopyresampled($imgResampled, $image, 0, 0, 0, 0, $intDstWidth, $intDstHeight, $intSrcWidth, $intSrcHeight);
             switch ($strMimeType) {
                 case 'image/gif':
                     imagegif($imgResampled, $this->flaCompanyLogo->File);
                     break;
                 case 'image/jpeg':
                 case 'image/pjpeg':
                     imagejpeg($imgResampled, $this->flaCompanyLogo->File);
                     break;
                 case 'image/png':
                 case 'image/x-png':
                     imagepng($imgResampled, $this->flaCompanyLogo->File);
                     break;
             }
         }
         rename($this->flaCompanyLogo->File, '../images/' . $this->flaCompanyLogo->FileName);
         if (AWS_S3) {
             QApplication::MoveToS3(__DOCROOT__ . __IMAGE_ASSETS__, $this->flaCompanyLogo->FileName, $strMimeType, '/images');
         }
         // Save the setting to the database
         QApplication::$TracmorSettings->CompanyLogo = $this->flaCompanyLogo->FileName;
     }
     // We have to cast these to string because the admin_settings value column is TEXT, and checkboxes give boolean values
     QApplication::$TracmorSettings->PortablePinRequired = (string) $this->chkPortablePinRequired->Checked;
     //QApplication::$TracmorSettings->StrictCheckinPolicy = (string) $this->chkStrictCheckinPolicy->Checked;
     // Show saved notification
     $this->pnlSaveNotification->Display = true;
 }
开发者ID:brustj,项目名称:tracmor,代码行数:70,代码来源:index.php

示例4: CopyUploaded

 public function CopyUploaded($file, $strFileName)
 {
     copy($file, $this->strUploadPath . $strFileName);
     if ($this->boolBuildThumbs) {
         $this->CreateThumbnail($this->strUploadPath . $strFileName, $this->strThumbUploadPath . $this->strThumbPrefix . $strFileName, $this->intThumbWidth, $this->intThumbHeight, $this->intThumbQuality);
     }
     if (AWS_S3) {
         QApplication::MoveToS3($this->strUploadPath, $strFileName, $this->strType, '/images/asset_models');
         if ($this->boolBuildThumbs) {
             if (file_exists($this->strThumbUploadPath . $strFileName)) {
                 QApplication::MoveToS3($this->strThumbUploadPath, $strFileName, $this->strType, '/images/asset_models/thumbs');
             }
         }
     }
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:15,代码来源:QImageFileControl.class.php

示例5: FedEx

 protected function FedEx()
 {
     // create new FedExDC object
     // $fed = new FedExDC($this->objShipment->ShippingAccount->Value);
     $fxWeightUnit = WeightUnit::Load($this->lstWeightUnit->SelectedValue);
     $fxLengthUnit = LengthUnit::Load($this->lstLengthUnit->SelectedValue);
     if ($fxLengthUnit) {
         $fxLengthUnitShortDescription = $fxLengthUnit->ShortDescription;
     } else {
         $fxLengthUnitShortDescription = '';
     }
     // Package Type
     $fxPackageType = PackageType::Load($this->lstPackageType->SelectedValue);
     //$fxPackageCount // Not implemented yet - FIXME
     $shipdate = $this->FxStrip($this->calShipDate->DateTime->__toString(QDateTime::FormatSoap));
     $shipdate = substr($shipdate, 0, 8);
     // create new FedExDC object
     // $fed = new FedExDC($this->objShipment->ShippingAccount->Value, $this->objShipment->FedexMeterNumber);
     if ($this->objFedexShipment->ShippingAccountId) {
         $fed = new FedExDC($this->objFedexShipment->ShippingAccount->AccessId, $this->objFedexShipment->ShippingAccount->AccessCode);
     } else {
         // if not billing to a sender account, use the default fedex account from admin_setting for FedEx communication
         $objFedexAccount = ShippingAccount::Load(QApplication::$TracmorSettings->FedexAccountId);
         $fed = new FedExDC($objFedexAccount->AccessId, $objFedexAccount->AccessCode);
     }
     if ($this->objFedexShipment->ToPhone) {
         $strRecipientPhone = $this->objFedexShipment->ToPhone;
     } else {
         $strRecipientPhone = '';
     }
     if ($this->objShipment->FromAddress->__toStringCountryAbbreviation() != $this->objShipment->ToAddress->__toStringCountryAbbreviation() && ($this->objShipment->FromAddress->__toStringCountryAbbreviation() != 'US' || $this->objShipment->ToAddress->__toStringCountryAbbreviation() != 'CA') && ($this->objShipment->ToAddress->__toStringCountryAbbreviation() != 'US' || $this->objShipment->FromAddress->__toStringCountryAbbreviation() != 'CA')) {
         $fxIntlSSN = '';
         //$this->objShipment->FromContact->Social								//Sender's SSN
         $fxCurrencyUnit = CurrencyUnit::Load($this->lstCurrencyUnit->SelectedValue);
         $fxIntlCurrencyUnit = $fxCurrencyUnit->ShortDescription;
         //Recipient Currency
         $fxIntlCustomsValue = number_format(round($this->txtValue->Text, 2), 2, '.', '');
         //Total Customs Value
         $fxIntlDutiesPayType = '1';
         //Duties Pay Type
         $fxIntlTermsofSale = '1';
         //Terms of Sale
         $fxIntlPartiestoTransation = 'N';
         //Parties to Transaction
     } else {
         $fxIntlSSN = '';
         //Sender's SSN
         $fxIntlCurrencyUnit = '';
         //Recipient Currency
         $fxIntlCustomsValue = '';
         //Total Customs Value
         $fxIntlDutiesPayType = '';
         //Duties Pay Type
         $fxIntlTermsofSale = '';
         //Terms of Sale
         $fxIntlPartiestoTransation = '';
         //Parties to Transaction
     }
     $fdx_arr = array(1 => $this->lblShipmentNumber->Text, 4 => $this->objShipment->FromCompany->__toString(), 32 => $this->objShipment->FromContact->__toString(), 5 => $this->objShipment->FromAddress->Address1, 6 => $this->objShipment->FromAddress->Address2, 7 => $this->objShipment->FromAddress->City, 8 => $this->objShipment->FromAddress->__toStringStateProvinceAbbreviation(), 9 => $this->objShipment->FromAddress->PostalCode, 117 => $this->objShipment->FromAddress->__toStringCountryAbbreviation(), 183 => $this->FxStrip($this->objShipment->FromCompany->Telephone), 11 => $this->objShipment->ToCompany->__toString(), 12 => $this->objShipment->ToContact->__toString(), 13 => $this->objShipment->ToAddress->Address1, 14 => $this->objShipment->ToAddress->Address2, 15 => $this->objShipment->ToAddress->City, 16 => $this->objShipment->ToAddress->__toStringStateProvinceAbbreviation(), 17 => $this->objShipment->ToAddress->PostalCode, 18 => $this->FxStrip($strRecipientPhone), 50 => $this->objShipment->ToAddress->__toStringCountryAbbreviation(), 57 => round($this->txtPackageHeight->Text, 0), 58 => round($this->txtPackageWidth->Text, 0), 59 => round($this->txtPackageLength->Text, 0), 23 => $this->lstBillTransportationTo->SelectedValue, 20 => $this->lstBillTransportationTo->SelectedValue !== 1 ? $this->txtRecipientThirdPartyAccount->Text : '', 75 => strtoupper($fxWeightUnit->ShortDescription), 1116 => strtoupper(substr($fxLengthUnitShortDescription, 0, 1)), 1273 => $fxPackageType->Value, 1274 => $this->objFedexShipment->FedexServiceType->Value, 1333 => '1', 1368 => 2, 1369 => $this->lstFedexLabelPrinterType->SelectedValue, 1370 => $this->lstFedexLabelPrinterType->SelectedValue === 1 ? 5 : $this->lstFedexLabelFormatType->SelectedValue, 2973 => 1, 1607 => 'SHIPPING', 1608 => 'SPECIAL', 1609 => 'HANDLING', 1610 => 'DISCOUNT', 1611 => 'TOTAL', 1624 => '1416', 1625 => '1417', 1626 => '3107', 1627 => '1418', 1628 => '1419', 1401 => number_format(round($this->txtPackageWeight->Text, 1), 1, '.', ''), 1201 => $this->txtFedexNotifySenderEmail->Text, 1202 => $this->txtFedexNotifyRecipientEmail->Text, 1204 => $this->txtFedexNotifyOtherEmail->Text, 1554 => $this->chkFedexNotifySenderShipFlag->Checked ? 'Y' : 'N', 1961 => $this->chkFedexNotifySenderExceptionFlag->Checked ? 'Y' : 'N', 1553 => $this->chkFedexNotifySenderDeliveryFlag->Checked ? 'Y' : 'N', 1557 => $this->chkFedexNotifyRecipientShipFlag->Checked ? 'Y' : 'N', 1962 => $this->chkFedexNotifyRecipientExceptionFlag->Checked ? 'Y' : 'N', 1556 => $this->chkFedexNotifyRecipientDeliveryFlag->Checked ? 'Y' : 'N', 1206 => $this->chkFedexNotifyOtherShipFlag->Checked ? 'Y' : 'N', 1960 => $this->chkFedexNotifyOtherExceptionFlag->Checked ? 'Y' : 'N', 1551 => $this->chkFedexNotifyOtherDeliveryFlag->Checked ? 'Y' : 'N', 1139 => $fxIntlSSN, 68 => $fxIntlCurrencyUnit, 1266 => $this->chkSaturdayDeliveryFlag->Checked ? 'Y' : 'N', 1200 => $this->chkHoldAtLocationFlag->Checked ? 'Y' : 'N', 44 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationAddress->Text : '', 46 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationCity->Text : '', 47 => $this->chkHoldAtLocationFlag->Checked && $this->objFedexShipment->HoldAtLocationStateObject ? $this->objFedexShipment->HoldAtLocationStateObject->Abbreviation : '', 48 => $this->chkHoldAtLocationFlag->Checked ? $this->txtHoldAtLocationPostalCode->Text : '', 1411 => $fxIntlCustomsValue, 70 => $fxIntlDutiesPayType, 72 => $fxIntlTermsofSale, 73 => $fxIntlPartiestoTransation, 79 => '', 80 => '', 24 => $shipdate, 1119 => 'Y', 25 => $this->objFedexShipment->Reference);
     if ($this->objFedexShipment->FedexServiceType->Value == '92') {
         $ship_Ret = $fed->ground_ship($fdx_arr);
     } else {
         $ship_Ret = $fed->express_ship($fdx_arr);
     }
     if ($error = $fed->getError()) {
         $blnError = true;
         $this->btnCompleteShipment->Warning = $error;
         return false;
     } else {
         // decode and save label
         $this->txtTrackingNumber->Text = $ship_Ret[29];
         $strLabelExtension = '.png';
         if ($this->objFedexShipment->LabelPrinterType == '2') {
             $strLabelExtension = '.epl';
         } else {
             if ($this->objFedexShipment->LabelPrinterType == '5') {
                 $strLabelExtension = '.zpl';
             }
         }
         $strLabelMimeType = $this->objFedexShipment->LabelPrinterType == '2' || $this->objFedexShipment->LabelPrinterType == '5' ? 'text/plain' : 'image/png';
         $fed->label('../images/shipping_labels/fedex/' . QApplication::$TracmorSettings->ImageUploadPrefix . $this->objShipment->ShipmentNumber . $strLabelExtension);
         if (AWS_S3) {
             QApplication::MoveToS3(__DOCROOT__ . __IMAGE_ASSETS__ . '/shipping_labels/fedex', QApplication::$TracmorSettings->ImageUploadPrefix . $this->objShipment->ShipmentNumber . $strLabelExtension, $strLabelMimeType, '/images/shipping_labels/fedex');
         }
         return true;
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:87,代码来源:shipment_edit.php


注:本文中的QApplication::MoveToS3方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。