/**
  * Attribute getter method
  * 
  * @return the imageURL of the component
  */
 function get_imageURL_attr()
 {
     $image = new WiziappImageHandler($this->data[0]['imageURL']);
     $size = WiziappConfig::getInstance()->getImageSize('audio_thumb');
     return $image->getResizedImageUrl(htmlspecialchars_decode($this->data[0]['imageURL']), $size['width'], $size['height']);
     //        return $this->data[0]['imageURL'];
 }
 function get_imageURL_attr()
 {
     $GLOBALS['WiziappLog']->write('info', "The preview image is:" . $this->data[0]['images'][0], 'imageGalleryCellItem.get_imageURL_attr');
     $image = new WiziappImageHandler($this->data[0]['images'][0]);
     $size = WiziappConfig::getInstance()->getImageSize('album_thumb');
     return $image->getResizedImageUrl($this->data[0]['images'][0], $size['width'], $size['height']);
     //return $this->data[0]['images'][0];
 }
 public function testWritingPermissions()
 {
     $logs = $GLOBALS['WiziappLog']->checkPath();
     $cacheHandler = new WiziappCache();
     $cache = $cacheHandler->checkPath();
     $thumbsHandler = new WiziappImageHandler();
     $thumbs = $thumbsHandler->checkPath();
     if (!$cache || !$logs || !$thumbs) {
         $message = 'It seems that your server settings are blocking access to certain directories. The WiziApp plugin requires writing permissions to the following directories:<br /><ul>';
         if (!$cache) {
             $message .= '<li>wp-content/uploads</li>';
         }
         if (!$logs) {
             $message .= '<li>wp-content/plugins/wiziapp/logs</li>';
         }
         if (!$thumbs) {
             $message .= '<li>wp-content/plugins/wiziapp/cache</li>';
         }
         $message .= '</ul>Though you may choose not to provide these permissions, this would mean that any requests by your iPhone App readers would be made in real time, which would deny you the advantages of caching.';
         // @todo format this i18n wordpress function usage to allow params and send the dir list as a parameter
         return new WiziappError('writing_permissions_error', __($message, 'wiziapp'));
     }
     return TRUE;
 }
 /**
  * Get the images we scanned for this post and it's replacement code
  * 
  * @param int $post_id the content id we are processing
  * @return array $replacements the array with the instructions for str_replace
  */
 function _getImagesReplacementCode($post_id)
 {
     $imagesElements = $GLOBALS['WiziappDB']->get_content_images($post_id);
     $replacements = array('find' => array(), 'replace' => array());
     if ($imagesElements !== FALSE) {
         foreach ($imagesElements as $image) {
             $GLOBALS['WiziappLog']->write('info', ">>> About to replace :: {$image['original_code']}", '_getImagesReplacementCode');
             $replacements['find'][] = $image['original_code'];
             $newImage = '<img ';
             $GLOBALS['WiziappLog']->write('info', ">>> The image info :: " . print_r($image, TRUE), '_getImagesReplacementCode');
             $attachInfo = json_decode($image['attachment_info'], TRUE);
             foreach ($attachInfo['attributes'] as $attrName => $attrValue) {
                 $value = str_replace('\\', '/', $attrValue);
                 $newImage .= " {$attrName}=\"{$value}\"";
             }
             /**
              * @todo Fix (remove) this once ticket 710 is fixed
              */
             global $thumbSize;
             if (count($imagesElements) >= WiziappConfig::getInstance()->count_minimum_for_appear_in_albums) {
                 $thumb = new WiziappImageHandler($attachInfo['attributes']['src']);
                 $thumbSize = WiziappConfig::getInstance()->getImageSize('album_thumb');
                 $url = $thumb->getResizedImageUrl($attachInfo['attributes']['src'], $thumbSize['width'], $thumbSize['height']);
                 $newImage .= " data-image-thumb=\"" . $url . "\"";
             }
             //                $json = json_encode($image);
             $id_code = " data-wiziapp-id=\"{$image['id']}\" ";
             $newImage .= $id_code . ' />';
             $GLOBALS['WiziappLog']->write('info', ">>> with this:: {$newImage}", '_getImagesReplacementCode');
             // Wordpress save the image without closing /> so let's check this too
             $replacements['find'][] = str_replace(' />', '>', $image['original_code']);
             $replacements['replace'][] = $newImage;
             // We have 2 find elements per image, so we need to replace, otherwise things gets buggy... :P
             $replacements['replace'][] = $newImage;
             //$replacements['replace'][] = str_replace('/>', "{$id_code}/><!-- {$json} -->", $image['original_code']);
         }
     }
     return $replacements;
 }
Exemplo n.º 5
0
function wiziapp_getImageUrl()
{
    $width = $_GET['width'];
    //if ($width == 0 || $width == '') {
    //        $width = $_GET['wiziapp/content/list/getimage?width'];
    //    }
    $image = new WiziappImageHandler($_GET['url']);
    $image->wiziapp_getResizedImage($width, $_GET['height'], $_GET['type'], $_GET['allow_up']);
}
 /**
  * Attribute getter method
  * 
  * @return the thumbnailURL of the component
  */
 function get_thumbnailURL_attr()
 {
     $image = new WiziappImageHandler($this->image->imageURL);
     $size = WiziappConfig::getInstance()->getImageSize('images_thumb');
     //return $image->getResizedImageUrl($this->image->imageURL, $size['width'], $size['height']);
     return $image->getResizedImageUrl($this->image->imageURL, $size['width'], 0);
     //return $this->image->thumbURL;
 }
 /**
  * Attribute getter method
  * 
  * @return the thumbnailURL of the component
  */
 function get_thumbnailURL_attr()
 {
     $image = new WiziappImageHandler($this->data[0]['thumb']);
     $size = WiziappConfig::getInstance()->getImageSize('video_album_thumb');
     return $image->getResizedImageUrl($this->data[0]['thumb'], $size['width'], $size['height']);
     //return $this->data[0]['thumb'];
 }
Exemplo n.º 8
0
function wiziapp_processImageForThumb($src, $size, $limitSize)
{
    $showedImage = FALSE;
    if (!empty($src)) {
        $image = new WiziappImageHandler($src);
        // The original image
        $image->load();
        $width = $image->getNewWidth();
        $height = $image->getNewHeight();
        if (intval($width) >= $limitSize['width'] && intval($height) >= $limitSize['height']) {
            if (intval($width) >= $size['width'] * 0.8 && intval($height) >= $size['height'] * 0.8) {
                //$imageUrl = $image->getResizedImageUrl($src, $size['width'], $size['height'], 'adaptiveResize', true);
                $image->wiziapp_getResizedImage($size['width'], $size['height'], 'adaptiveResize', true);
                $showedImage = TRUE;
            }
        }
    }
    return $showedImage;
}