/**
  * Create a new cached image.
  * @param string $filename The filename of the image.
  * @param boolean $isSingleton This this to true if this is a singleton() object, a stub for calling methods.  Singletons
  * don't have their defaults set.
  */
 public function __construct($filename = null, $isSingleton = false)
 {
     parent::__construct(array(), $isSingleton);
     $this->Filename = $filename;
 }
コード例 #2
0
 public function setPreviewImage(SecureImage $Img)
 {
     if (!$this->PreviewImage() instanceof VideoImage) {
         if ($this->PreviewImage()->exists()) {
             $this->PreviewImage()->delete();
         }
     }
     $this->PreviewImageID = $Img->ID;
     $lib = new \Vimeo\Vimeo(Config::inst()->get('VimeoVideoFile', 'client_id'), Config::inst()->get('VimeoVideoFile', 'client_secret'), Config::inst()->get('VimeoVideoFile', 'access_token'));
     $video_data = $lib->uploadImage($this->VimeoURI . '/pictures', $Img->getFullPath(), true);
     // Upload the PreviewPicture as
     $this->appendLog($this->getLogFile(), 'New Image uploaded', print_r($video_data, true));
     $this->write();
 }
コード例 #3
0
 function _fileUpload($AG_itemURL, $file)
 {
     $config = JFactory::getConfig();
     $tmp_dest = $config->get('tmp_path');
     $ag_ext_valid = array("jpg", "jpeg", "gif", "png", "zip");
     //Clean up filename to get rid of strange characters like spaces etc
     $filename = JFile::makeSafe($file['name']);
     $ag_file_ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
     $src = $file['tmp_name'];
     $dest = $tmp_dest . DIRECTORY_SEPARATOR . $filename;
     // FILTER EXTENSION
     $ag_ext_check = array_search($ag_file_ext, $ag_ext_valid);
     if (is_numeric($ag_ext_check)) {
         if (JFile::upload($src, $dest)) {
             if ($ag_file_ext == "zip") {
                 //
                 if (JArchive::extract($tmp_dest . DIRECTORY_SEPARATOR . $filename, $tmp_dest . DIRECTORY_SEPARATOR . 'AdmirorImageUpload' . DIRECTORY_SEPARATOR . JFile::stripExt($filename))) {
                     $files = JFolder::files($tmp_dest . DIRECTORY_SEPARATOR . 'AdmirorImageUpload' . DIRECTORY_SEPARATOR . JFile::stripExt($filename), '.', true, true);
                     foreach ($files as $file_path) {
                         $image = new SecureImage($file_path);
                         if (!$image->CheckIt()) {
                             JFile::delete($file_path);
                         }
                     }
                     JFolder::copy($tmp_dest . DIRECTORY_SEPARATOR . 'AdmirorImageUpload' . DIRECTORY_SEPARATOR . JFile::stripExt($filename), JPATH_SITE . $AG_itemURL . JFile::stripExt($filename), '', true);
                     JFile::delete($tmp_dest . DIRECTORY_SEPARATOR . $filename);
                     JFolder::delete($tmp_dest . DIRECTORY_SEPARATOR . 'AdmirorImageUpload' . DIRECTORY_SEPARATOR . JFile::stripExt($filename));
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_ZIP_PACKAGE_IS_UPLOADED_AND_EXTRACTED') . " " . $filename, 'message');
                 }
             } else {
                 if (JFile::copy($tmp_dest . DIRECTORY_SEPARATOR . $filename, JPATH_SITE . $AG_itemURL . $filename)) {
                     JFile::delete($tmp_dest . DIRECTORY_SEPARATOR . $filename);
                     JFactory::getApplication()->enqueueMessage(JText::_('AG_IMAGE_IS_UPLOADED') . " " . $filename, 'message');
                 }
             }
         } else {
             $ag_error[] = array();
             JFactory::getApplication()->enqueueMessage(JText::_('AG_CANNOT_UPLOAD_FILE') . " " . $filename, 'error');
         }
     } else {
         JFactory::getApplication()->enqueueMessage(JText::_("AG_ONLY_JPG_JPEG_GIF_PNG_AND_ZIP_ARE_VALID_EXTENSIONS"), 'error');
     }
 }