Exemple #1
0
 public function renderImage($intPersonId)
 {
     $objControlId = "personImage" . $intPersonId;
     if (!($objControl = $this->GetControl($objControlId))) {
         $objControl = new QImageControl($this, $objControlId);
         $imagePath = "../images/emoticons/" . $intPersonId . ".png";
         if (file_exists($imagePath)) {
             // Beautiful images are courtesy of Yellow Icon at http://yellowicon.com/downloads/page/4
             $objControl->ImagePath = $imagePath;
         } else {
             $objControl->ImagePath = "../images/emoticons/1.png";
             // fail-over case: default image
         }
     }
     // We pass the parameter of "false" to make sure the control doesn't render
     // itself RIGHT HERE - that it instead returns its string rendering result.
     return $objControl->Render(false);
 }
 public function renderImage($intPersonId)
 {
     $objControlId = "personImage" . $intPersonId;
     if (!($objControl = $this->GetControl($objControlId))) {
         $objControl = new QImageControl($this->dtgPersons, $objControlId);
         // And finally, let's specify a CacheFolder so that the images are cached
         // Notice that this CacheFolder path is a complete web-accessible relative-to-docroot path
         $objControl->CacheFolder = __VIRTUAL_DIRECTORY__ . __EXAMPLES__ . '/datagrid/cache';
         $imagePath = "../images/emoticons/" . $intPersonId . ".png";
         if (file_exists($imagePath)) {
             // Beautiful images are courtesy of Yellow Icon at http://yellowicon.com/downloads/page/4
             $objControl->ImagePath = $imagePath;
         } else {
             $objControl->ImagePath = "../images/emoticons/1.png";
             // fail-over case: default image
         }
     }
     // We pass the parameter of "false" to make sure the control doesn't render
     // itself RIGHT HERE - that it instead returns its string rendering result.
     return $objControl->Render(false);
 }
 protected function AddHeadShotToPanel($mixSource, $blnSetAsActive, $intIdFromDatabase = null)
 {
     $imgHeadShot = new QImageControl($this->dtrHeadShots);
     if ($mixSource instanceof QFileUploader) {
         $imgHeadShot->SetImagePathFromFileUploader($mixSource);
     } else {
         if (is_file($mixSource)) {
             $imgHeadShot->ImagePath = $mixSource;
         } else {
             $imgHeadShot->ImagePath = __DOCROOT__ . __IMAGE_ASSETS__ . '/no_headshot.png';
         }
     }
     $imgHeadShot->Width = 160;
     $imgHeadShot->Height = 160;
     $imgHeadShot->ActionParameter = $intIdFromDatabase;
     if ($blnSetAsActive) {
         $this->strSelectedImageControlId = $imgHeadShot->ControlId;
     }
     $imgHeadShot->ToolTip = 'Set as Active';
     $imgHeadShot->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'imgHeadShot_Click'));
     $this->imgHeadShotArray[] = $imgHeadShot;
 }
Exemple #4
0
<?php

require '../../../includes/prepend.inc.php';
QImageControl::Run();
 /**
  * This will return the web/docroot-relative path for the dialog-box image for this showcase item image
  * NOTE: if the thumbnail does not exist, this will also CREATE the thumbnail
  * @return string
  */
 public function GetDialogBoxPath()
 {
     // calculate the web/docroot-relative path
     $strThumbPath = $this->GetDialogBoxFolder() . '/dbox-' . $this->intId . '.' . ImageFileType::$ExtensionArray[$this->intImageFileTypeId];
     // See if the thumbnail image, itself exists
     if (file_exists(__DOCROOT__ . $strThumbPath)) {
         return $strThumbPath;
     }
     // It does NOT exist -- we need to create it first
     QApplication::MakeDirectory(__DOCROOT__ . $this->GetThumbFolder(), 0777);
     $objImageControl = new QImageControl(null);
     $objImageControl->ImagePath = $this->GetImagePath();
     $objImageControl->Width = 300;
     $objImageControl->Height = 300;
     $objImageControl->ScaleCanvasDown = false;
     $objImageControl->ScaleImageUp = true;
     $objImageControl->RenderImage(__DOCROOT__ . $strThumbPath);
     return $strThumbPath;
 }
 public function reload()
 {
     $this->RemoveChildControls(true);
     $img = null;
     // get the QImageBrowser control
     $objImageBrowser = $this->ParentControl;
     while (!$objImageBrowser instanceof QImageBrowserBase) {
         $objImageBrowser = $objImageBrowser->ParentControl;
         if (is_null($objImageBrowser) || $objImageBrowser instanceof QForm) {
             throw new QCallerException("QImageBrowserThumbnails must be inside a QImageBrowser");
         }
     }
     $iEnd = $objImageBrowser->ImageCount();
     for ($i = 0; $i < $iEnd; ++$i) {
         $strImagePath = $objImageBrowser->ThumbnailImagePath($i);
         $img = new QImageControl($this);
         $img->CssClass = 'ib_thm_image';
         $img->ImagePath = $strImagePath;
         $img->AlternateText = $strImagePath;
         $img->ActionParameter = $i;
         // And finally, let's specify a CacheFolder so that the images are cached
         // Notice that this CacheFolder path is a complete web-accessible relative-to-docroot path
         $img->CacheFolder = __IMAGE_CACHE_ASSETS__;
         $img->AddAction(new QClickEvent(), new QAjaxControlAction($objImageBrowser, "imgThm_Click"));
     }
     if ($img) {
         $img->CssClass = 'ib_thm_image ib_thm_image_last';
         $this->Text = '';
     } else {
         $this->Text = QApplication::Translate('No thumbnails');
     }
 }
 public function reload()
 {
     $this->RemoveChildControls(true);
     $img = null;
     // get the QImageBrowser control
     $objImageBrowser = $this->ParentControl;
     while (!$objImageBrowser instanceof QImageBrowserBase) {
         $objImageBrowser = $objImageBrowser->ParentControl;
         if (is_null($objImageBrowser) || $objImageBrowser instanceof QForm) {
             throw new QCallerException("QImageBrowserThumbnails must be inside a QImageBrowser");
         }
     }
     $iEnd = $objImageBrowser->ImageCount();
     for ($i = 0; $i < $iEnd; ++$i) {
         $strImagePath = $objImageBrowser->ThumbnailImagePath($i);
         $img = new QImageControl($this);
         $img->CssClass = 'ib_thm_image';
         $img->ImagePath = $strImagePath;
         $img->AlternateText = $strImagePath;
         $img->ActionParameter = $i;
         $img->AddAction(new QClickEvent(), new QAjaxControlAction($objImageBrowser, "imgThm_Click"));
     }
     if ($img) {
         $img->CssClass = 'ib_thm_image ib_thm_image_last';
         $this->Text = '';
     } else {
         $this->Text = QApplication::Translate('No thumbnails');
     }
 }