Author: mgiagnoni
Date: 2010-09-06 11:20:38 +0200 (Mon, 06 Sep 2010)
New Revision: 30836
Modified:
plugins/lyMediaManagerPlugin/trunk/lib/helper/lyMediaHelper.php
plugins/lyMediaManagerPlugin/trunk/lib/lyMediaTools.class.php
plugins/lyMediaManagerPlugin/trunk/lib/model/doctrine/PluginlyMediaAsset.class.php
plugins/lyMediaManagerPlugin/trunk/modules/lyMediaAsset/templates/_asset_icon.php
Log:
Removed some functions from 'tools' class.
Modified: plugins/lyMediaManagerPlugin/trunk/lib/helper/lyMediaHelper.php
===================================================================
--- plugins/lyMediaManagerPlugin/trunk/lib/helper/lyMediaHelper.php
2010-09-05 23:51:41 UTC (rev 30835)
+++ plugins/lyMediaManagerPlugin/trunk/lib/helper/lyMediaHelper.php
2010-09-06 09:20:38 UTC (rev 30836)
@@ -34,9 +34,23 @@
function thumbnail_image_tag($asset, $folder_path = null, $type ='small',
$options = array())
{
- return image_tag(lyMediaTools::getThumbnailURI($asset, $folder_path, $type),
$options);
+ return image_tag(thumbnail_uri($asset, $folder_path, $type), $options);
}
function thumbnail_image_path($asset, $folder_path = null, $type ='small')
{
- return image_path(lyMediaTools::getThumbnailURI($asset, $folder_path,
$type));
+ return image_path(thumbnail_uri($asset, $folder_path, $type));
+}
+
+function thumbnail_uri($asset, $folder_path = null, $type ='small')
+{
+ if($asset->supportsThumbnails())
+ {
+ $uri = '/' . (isset($folder_path) ? $folder_path :
$asset->getFolderPath()) . lyMediaThumbnails::getThumbnailFolder() . '/' .
$asset->getThumbnailFile($type);
+ }
+ else
+ {
+ $uri = '/lyMediaManagerPlugin/images/' . $asset->getThumbnailFile($type);
+ }
+
+ return $uri;
}
\ No newline at end of file
Modified: plugins/lyMediaManagerPlugin/trunk/lib/lyMediaTools.class.php
===================================================================
--- plugins/lyMediaManagerPlugin/trunk/lib/lyMediaTools.class.php
2010-09-05 23:51:41 UTC (rev 30835)
+++ plugins/lyMediaManagerPlugin/trunk/lib/lyMediaTools.class.php
2010-09-06 09:20:38 UTC (rev 30836)
@@ -42,65 +42,11 @@
));
}
- public static function getAssetURI($asset)
- {
- return '/' . $asset->getPath();
- }
-
public static function getBasePath()
{
return sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR;
}
- public static function getThumbnailFile($asset, $type = 'small')
- {
- $thumbnail = 'unknown.png';
-
- if($asset->supportsThumbnails())
- {
- $thumbnail = $type . '_' . $asset->getFilename();
- }
- else
- {
- list($mtype, $mstype) = explode('/', $asset->getType());
-
- switch($mtype)
- {
- case 'image':
- $thumbnail = 'image-x-generic.png';
- break;
- case 'application':
- switch($mstype)
- {
- case 'pdf':
- case 'x-pdf':
- $thumbnail = 'application-pdf.png';
- break;
- }
- break;
- case 'text':
- $thumbnail = 'text-x-generic.png';
- break;
- }
- }
-
- return $thumbnail;
- }
-
- public static function getThumbnailURI($asset, $folder_path, $type = 'small')
- {
- if($asset->supportsThumbnails())
- {
- $img = '/' . (isset($folder_path) ? $folder_path :
$asset->getFolderPath()) . lyMediaThumbnails::getThumbnailFolder() . '/' .
self::getThumbnailFile($asset, $type);
- }
- else
- {
- $img = '/lyMediaManagerPlugin/images/' . self::getThumbnailFile($asset,
$type);
- }
-
- return $img;
- }
-
public static function log($message, $color = '')
{
switch ($color)
Modified:
plugins/lyMediaManagerPlugin/trunk/lib/model/doctrine/PluginlyMediaAsset.class.php
===================================================================
---
plugins/lyMediaManagerPlugin/trunk/lib/model/doctrine/PluginlyMediaAsset.class.php
2010-09-05 23:51:41 UTC (rev 30835)
+++
plugins/lyMediaManagerPlugin/trunk/lib/model/doctrine/PluginlyMediaAsset.class.php
2010-09-06 09:20:38 UTC (rev 30836)
@@ -50,6 +50,46 @@
}
/**
+ * Returns asset thumbnail filename.
+ *
+ * @param string $thumb_type thumbnail type.
+ */
+ public function getThumbnailFile($thumb_type = 'small')
+ {
+ $thumbnail = 'unknown.png';
+
+ if($this->supportsThumbnails())
+ {
+ $thumbnail = $thumb_type . '_' . $this->getFilename();
+ }
+ else
+ {
+ list($mtype, $mstype) = explode('/', $this->getType());
+
+ switch($mtype)
+ {
+ case 'image':
+ $thumbnail = 'image-x-generic.png';
+ break;
+ case 'application':
+ switch($mstype)
+ {
+ case 'pdf':
+ case 'x-pdf':
+ $thumbnail = 'application-pdf.png';
+ break;
+ }
+ break;
+ case 'text':
+ $thumbnail = 'text-x-generic.png';
+ break;
+ }
+ }
+
+ return $thumbnail;
+ }
+
+ /**
* postDelete.
*
* @param Doctrine_Event $event
Modified:
plugins/lyMediaManagerPlugin/trunk/modules/lyMediaAsset/templates/_asset_icon.php
===================================================================
---
plugins/lyMediaManagerPlugin/trunk/modules/lyMediaAsset/templates/_asset_icon.php
2010-09-05 23:51:41 UTC (rev 30835)
+++
plugins/lyMediaManagerPlugin/trunk/modules/lyMediaAsset/templates/_asset_icon.php
2010-09-06 09:20:38 UTC (rev 30836)
@@ -3,7 +3,7 @@
<?php if($popup): ?>
<div class="lymedia_popup_info">
<span>
- <?php echo image_path(lyMediaTools::getAssetURI($asset)); ?>
+ <?php echo image_path('/' . $asset->getPath()); ?>
</span>
<?php foreach(lyMediaThumbnails::getThumbnailSettings() as $type =>
$params): ?>
<span class="<?php echo $type; ?>">
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.