->setModel('Fluidbook_Model_Reference')\r
->setTitleColumn("title")\r
->setAdditionnalColumns(array('fluidbook_id', 'featured', 'date'))\r
- ->setSearchColumns(array('text', 'fluidbook_id'));\r
+ ->setSearchColumns(array('text', 'fluidbook_id', 'title'));\r
}\r
}
\ No newline at end of file
'blendmode' => array('prop' => 'background-blend-mode', 'format' => '%s'),\r
);\r
\r
+ $left = $this->_getPage($fluidbook_id, $page);\r
+ $right = $this->_getPage($fluidbook_id, $page + 1);\r
+\r
+ $ratio = $left['width'] / $left['height'];\r
+\r
$backgrounds = array();\r
- $backgrounds[] = array('image' => $this->_getPage($fluidbook_id, $page, array('class' => 'left')), 'size' => '', 'position' => '0,0', 'blendmode' => null);\r
- $backgrounds[] = array('image' => $this->_getPage($fluidbook_id, $page + 1, array('class' => 'right')), 'size' => '', 'position' => '0,100%', 'blendmode' => 'normal');\r
- $backgrounds[] = array('image' => '/images/exemples/publications/dark.png', 'size' => '', 'position' => '', 'blendmode' => '');\r
- $backgrounds[] = array('image' => '/images/exemples/publications/light.png', 'size' => '', 'position' => '', 'blendmode' => '');\r
- $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '', 'position' => '', 'blendmode' => '');\r
+ // $backgrounds[] = array('image' => '/images/exemples/publications/shadow.png', 'size' => '100% 10%', 'position' => '0 95%', 'blendmode' => null);\r
+ $backgrounds[] = array('image' => $left['url'], 'size' => '50% 100%', 'position' => '0 0', 'blendmode' => null);\r
+ $backgrounds[] = array('image' => $right['url'], 'size' => '50% 100%', 'position' => '100% 0', 'blendmode' => 'normal');\r
+ $backgrounds[] = array('image' => '/images/exemples/publications/light.png', 'size' => '30% 100%', 'position' => '50% 0', 'blendmode' => 'overlay');\r
+ $backgrounds[] = array('image' => '/images/exemples/publications/dark.png', 'size' => '20% 100%', 'position' => '50% 0', 'blendmode' => 'multiply');\r
+\r
+\r
+ $backgrounds = array_reverse($backgrounds);\r
\r
\r
$res = '<style type="text/css">';\r
\r
$res .= '}';\r
$res .= '</style>';\r
- $res .= $this->htmlElement('', 'div', array('class' => 'exemple-fluidbook', 'id' => $cssid));\r
+ $res .= $this->htmlElement($this->htmlElement('', 'div', array('class' => 'shadow')), 'div', array('class' => 'exemple-fluidbook', 'id' => $cssid, 'data-width' => $left['width'] * 2, 'data-height' => $left['height']));\r
return $res;\r
}\r
\r
protected function _getPage($fluidbook_id, $page) {\r
$path = 'fluidbook/' . $fluidbook_id . '/';\r
- $dir = PUBLIC_PATH . $path;\r
+ $dir = FILES_PATH . '/' . $path;\r
if (!file_exists($dir)) {\r
mkdir($dir, 0777, true);\r
}\r
+\r
$url = '/files/' . $path . $page . '.jpg';\r
$file = $dir . $page . '.jpg';\r
if (!file_exists($file)) {\r
- file_put_contents($file, file_get_contents('https://workshop.fluidbook.com/viewerh/' . $fluidbook_id . '_bcf26f9cf4a795ec00b9a44f42750d58_1234567890/data/background/150/t' . $page . '.jpg'));\r
+ $url = 'https://workshop.fluidbook.com/viewerh/' . $fluidbook_id . '_bcf26f9cf4a795ec00b9a44f42750d58_1234567890/data/background/150/t' . $page . '.jpg';\r
+ file_put_contents($file, file_get_contents($url));\r
}\r
- return $url;\r
+ $size = CubeIT_Image::getDimensions($file, $width, $height);\r
+ return array('url' => $url, 'width' => $width, 'height' => $height);\r
}\r
}
\ No newline at end of file
* @return string\r
*/\r
public function exemples($category, $title, $nb) {\r
+ $this->headScript()->addMasonry()->addJQueryTransform();\r
$this->headScript()->addScriptAndStyle('220-exemples');\r
- $this->headScript()->addMasonry();\r
\r
$exemples = Fluidbook_Model_Reference::factory()->order('date DESC')->find();\r
\r
$featured = array();\r
$normal = array();\r
foreach ($exemples as $id => $exemple) {\r
-\r
- fb($exemple->getCategories());\r
-\r
if ($category > 0 && !in_array($category, $exemple->getCategories())) {\r
continue;\r
}\r
}\r
}\r
\r
- fb($featured);\r
- fb($normal);\r
-\r
-\r
$nb_featured = count($featured);\r
if ($nb_featured < $max_featured) {\r
for ($i = $nb_featured; $i < $max_featured; $i++) {\r
$res .= $this->htmlElement($f->getText(), 'p');\r
}\r
\r
+ $image = CubeIT_Util_Cms::extractFile($f->getImage());\r
\r
- if ($f->getFluidbookId()) {\r
+ if (!$image && $f->getFluidbookId()) {\r
$res .= $this->exemplePublication($f->getFluidbookId(), $f->getFluidbookPage());\r
} else {\r
$res .= $this->htmlElement('', 'div',\r
- array('style' => 'background-image:url(' . $this->imageProcess()->imageProcessGetURL($f->getImage(), $f->getTitle() . ' - ' . $f->getText(), 660, 440, array(), 'R') . ');',\r
+ array('style' => 'background-image:url(' . $this->imageProcess()->imageProcessGetURL($image, $f->getTitle() . ' - ' . $f->getText(), 660, 440, array(), 'R') . ');',\r
'class' => 'img')\r
);\r
}\r
// We retract the header when user scrolled down of 400px\r
htop = (600 - scrolledDistance) - headerHeight;\r
}\r
- fb(htop);\r
}\r
// Normalize top value\r
$("header").css('top', Math.max(-headerHeight, Math.min(adminHeight, htop + adminHeight)));\r
$(".publications").masonry({\r
itemSelector: "a",\r
});\r
+\r
+\r
+ $(".exemple-fluidbook").each(function () {\r
+ var w = parseInt($(this).data('width'));\r
+ var h = parseInt($(this).data('height'));\r
+\r
+ var container = $(this).closest('a');\r
+ var cw = $(container).outerWidth() * 0.8;\r
+ var ch = $(container).outerHeight() * 0.6;\r
+\r
+ var s = Math.min(cw / w, ch / h);\r
+\r
+ w *= s;\r
+ h *= s;\r
+\r
+ var left = ((cw / 0.8) - w) / 2;\r
+\r
+\r
+ $(this).css({width: w, height: h, left: left,fontSize:(w/600)*10});\r
+ });\r
}\r
display: inline-block;\r
text-decoration: none;\r
padding: 25px 30px;\r
+ position: relative;\r
\r
font-family: @opensans;\r
font-size: 14px;\r
font-weight: 400;\r
text-transform: uppercase;\r
line-height: 18px;\r
- margin-bottom:12px;\r
+ margin-bottom: 12px;\r
}\r
\r
&:nth-of-type(even) {\r
background-color: transparent;\r
&:nth-of-type(11n+1) {\r
background: linear-gradient(45deg, rgba(249, 134, 126, 1) 0%, rgba(231, 92, 123, 1) 100%);\r
- button{\r
- .border-button-fill(#fff,rgba(231, 92, 123, 1));\r
+ button {\r
+ .border-button-fill(#fff, rgba(231, 92, 123, 1));\r
}\r
}\r
&:nth-child(11n+9) {\r
background: linear-gradient(45deg, #f5aa72 0%, #f6786e 100%);\r
- button{\r
- .border-button-fill(#fff,#f6786e);\r
+ button {\r
+ .border-button-fill(#fff, #f6786e);\r
}\r
}\r
img {\r
height: auto;\r
}\r
- button{\r
- color:#fff;\r
- border:1px solid #fff;\r
- padding:0 20px;\r
- margin-left:20px;\r
+ button {\r
+ color: #fff;\r
+ border: 1px solid #fff;\r
+ padding: 0 20px;\r
+ margin-left: 20px;\r
margin-top: 5px;\r
\r
-\r
}\r
}\r
}\r
}\r
+}\r
+\r
+.exemple-fluidbook {\r
+ border-right: 1em solid #dddddd;\r
+ border-left: 0.2em solid #cfc0c0;\r
+ box-shadow: 0 0.4em 0.6em rgba(0, 0, 0, 0.2);\r
+ position: absolute;\r
+ z-index: 1;\r
+ transform-origin: 0 0;\r
+ margin: 0 auto;\r
+ bottom: 10%;\r
+\r
+ .shadow {\r
+ background-image: url("/images/exemples/publications/shadow.png");\r
+ background-position: 50% 100%;\r
+ background-size: 95% 100%;\r
+ width: 105%;\r
+ height: 5%;\r
+ bottom: -5%;\r
+ left: -3%;\r
+ position: absolute;\r
+ z-index: 0;\r
+ }\r
}
\ No newline at end of file