/**
  * Set Upload Path
  * 
  * ## Overview
  *
  * @uses $_FILES
  *
  * @param string $path Path to uploads directory.
  *
  * @return true Always unless fatal error or exception is thrown.
  *
  * @version 2015-07-05.1
  * @since 0.6.5b
  * @author TronNet DevOps [Sean Murray] <*****@*****.**>
  */
 public static function SetPath($path)
 {
     DebugManager::Log("Setting Upload Path", '@');
     DebugManager::Log(self::$path);
     self::$path = $path . '/';
     return true;
 }
 /**
  * Register image element.
  * 
  * @param IdmlImage $idmlImage containing mediaFilename and optionally containing imageContent (from parsed CDATA).
  * @param IdmlElement $idmlContainer is the wrapper of the image, which is needed for cropping operations.
  */
 public function registerImage(IdmlImage $idmlImage, $idmlContainer)
 {
     $tmpPath = null;
     $containersAllowed = array('IdmlRectangle', 'IdmlPolygon');
     // If the image data has come from embedded CDATA . . .
     if ($idmlImage->embeddedImage && strlen($idmlImage->imageContent) > 0) {
         $tmpPath = $this->FileManager->getTmpPath();
         $registerFilename = $this->createImageFromCdata($idmlImage, $tmpPath);
     } else {
         // assemble the filename path, within the S3 bucket, and verify that it exists
         $registerFilename = $this->getImageFile($idmlImage);
         if ($registerFilename == null) {
             $idmlImage->mediaFilename .= " [image not found]";
             return;
         }
     }
     // Crop the picture if asked to
     if ($idmlContainer != null && in_array(get_class($idmlContainer), $containersAllowed)) {
         if (MediaManager::isVectorImage($registerFilename)) {
             // skip for now, because cropping .ai is crashing IMagick
         } else {
             $this->cropImage($idmlImage, $idmlContainer, $registerFilename);
         }
     }
     // Does this image need to be converted?
     if (MediaManager::isConvertableImage($registerFilename)) {
         $idmlImage->mediaFilename = $this->processor->convertUnsupportedImageType($registerFilename);
     }
 }
 /**
  * Load your component.
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function load(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CORELANG, $subMenuTitle, $objTemplate, $plainSection;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             $objMedia = new Media(\Env::get('cx')->getPage()->getContent(), $plainSection . MODULE_INDEX);
             \Env::get('cx')->getPage()->setContent($objMedia->getMediaPage());
             break;
         case \Cx\Core\Core\Controller\Cx::MODE_BACKEND:
             $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'LegacyContentMaster.html');
             $objTemplate = $this->cx->getTemplate();
             $subMenuTitle = $_CORELANG['TXT_MEDIA_MANAGER'];
             $objMedia = new MediaManager();
             $objMedia->getMediaPage();
             break;
         default:
             break;
     }
 }
 /**
  * Disables the feature
  */
 public static function disable()
 {
     remove_action('add_meta_boxes', array(__CLASS__, 'register_metaboxes'));
     //remove_action('save_post', array(__CLASS__, 'save_metabox_data'));
     remove_action('init', array(__CLASS__, 'register_assets'));
     //remove_filter('media_view_settings', array(__CLASS__, 'media_view_settings'), 10, 2);
     remove_action('wp_ajax_wpu-media-manager-update', array(__CLASS__, 'wp_ajax_media_manager_gallery_update'));
     remove_action('admin_print_scripts', array(__CLASS__, 'register_assets'));
     self::$enabled = false;
 }
Example #5
0
 /**
  * Primary processing routine for the source
  */
 private function processBook()
 {
     // Get Media manager and preset page parameters
     $mediaManager = new MediaManager($this->bookId);
     $pageCount = count($this->sourceFiles) + count($this->sourceAssets);
     $pageNumber = 1;
     // Prepare the progress
     $this->progress->startProgress($pageCount * 2);
     $this->updatePageCount(0);
     $bookSizeFound = false;
     // Loop through source files
     foreach ($this->sourceFiles as $source) {
         CakeLog::debug('[ImageProcessor::processBook] processing source file ' . $source);
         // Get book size
         if (!$bookSizeFound) {
             $bookWidth = 0;
             $bookHeight = 0;
             $this->getBookSizeImage($source, $bookWidth, $bookHeight);
             CakeLog::debug('[ImageProcessor::processBook] Book dimensions set to ' . $bookWidth . ' x ' . $bookHeight);
             $this->updateBookSize($bookWidth, $bookHeight);
             $bookSizeFound = true;
         }
         // Convert to png as needed
         if (MediaManager::isConvertableImage($source)) {
             CakeLog::debug('[ImageProcessor::processBook] Converting ' . $source . ' to png');
             $mediaManager->imageConvertToPng($source, $source);
         }
         // Resize image to max dimension.
         $image = new Imagick($source);
         $width = $image->getimagewidth();
         $height = $image->getimageheight();
         // Get new width and height
         list($newWidth, $newHeight) = $this->getResizedDimensionsForMaxPixels($width, $height);
         if ($newHeight != $height || $newWidth != $width) {
             CakeLog::debug('[ImageProcessor::processBook] ' . $source . ' resized for max pixel limits to ' . $newWidth . 'x' . $newHeight);
             // Resize the original image
             $img = new Imagick($source);
             $img->resizeimage($newWidth, $newHeight, Imagick::FILTER_LANCZOS, 1, false);
             $img->writeimage();
         }
         $this->addImageAssetToBook($source, 'images/backgrounds/');
         $this->savePageHTML('', $pageNumber, null, '../images/backgrounds/' . basename($source));
         @unlink($source);
         $this->savePageCSS('', $pageNumber);
         // Count page
         $pageNumber++;
         // Update the progress in database every 10th page.
         $this->progress->incrementStep();
     }
     //handle any non-source assets included with the book source files
     $this->importSourceAssets();
     $this->setCoverImage();
     // Save default book CSS
     $this->saveBookCSS('');
     // Generate thumbnails
     $this->generateThumbnails(1, $pageCount);
     $this->updatePageCount($pageCount);
     CakeLog::debug('[ImageProcessor::processBook] Book Processing Complete');
 }
Example #6
0
    {
        foreach ($media as $value) {
            $this->media[$value->getName()] = $value;
        }
        $this->length = count($this->media);
    }
    public function AddMedia($m)
    {
        $this->media[$m->getName()] = $m;
        $this->length++;
    }
    public function RemoveMedia($m)
    {
        $index = array_search($m->getName(), array_keys($this->media));
        array_splice($this->media, $index, 1);
        $this->length--;
    }
    public function GetMedia()
    {
        return $this->media;
    }
}
$mov1 = new Movie("movie1", "2000");
$song1 = new Symphony("song1", "1900", "classical");
$mov2 = new Movie("Commando", "1985");
$manager = new MediaManager([$mov1, $mov2, $song1]);
print_r($manager->GetMedia());
//echo $song1->printout();
//echo $song1->recommend();
//print_r($mov1);
//print_r($song1);
 /**
  * @return string
  */
 public function getMediaUrl()
 {
     if (defined('MEDIA_MANAGER') && $this->getMedia_id()) {
         return MediaManager::getMediaUrl($this->getMedia_id(), MEDIA_MANAGER_SIZE);
     }
 }
 public function postInit()
 {
     return \MediaManager::init();
 }
Example #9
0
 function GetMedias()
 {
     $mediaManager = new MediaManager();
     return $mediaManager->GetMedias($this->m_path);
 }