/** * 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]; }
/** * 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; }
/** * 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']; }