summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Bello <tylerbello@users.sourceforge.net>2009-10-15 20:03:58 +0000
committerTyler Bello <tylerbello@users.sourceforge.net>2009-10-15 20:03:58 +0000
commita134e0b65e42f58e04de3d964934d72b931c9194 (patch)
treed381cb1ba1c1c5899739076e382c8d5774b8c145
parent89436a4ad41b266147848d59eadbf8b5557a8145 (diff)
downloadliberty-a134e0b65e42f58e04de3d964934d72b931c9194.tar.gz
liberty-a134e0b65e42f58e04de3d964934d72b931c9194.tar.bz2
liberty-a134e0b65e42f58e04de3d964934d72b931c9194.zip
Add width and height attributes to image in mime attachment tpl so that they actually respect the size that was passed in
-rw-r--r--LibertyContent.php12
-rw-r--r--plugins/data.attachment.php18
-rw-r--r--templates/mime/default/attachment.tpl4
3 files changed, 16 insertions, 18 deletions
diff --git a/LibertyContent.php b/LibertyContent.php
index 250dd78..cc28a1a 100644
--- a/LibertyContent.php
+++ b/LibertyContent.php
@@ -1,9 +1,9 @@
<?php
/**
-* Management of Liberty content
+/* Management of Liberty content
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.410 2009/10/01 14:17:01 wjames5 Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.411 2009/10/15 20:03:57 tylerbello Exp $
* @author spider <spider@steelsun.com>
*/
@@ -315,7 +315,6 @@ class LibertyContent extends LibertyBase {
$pParamHash['preferences_store'][$pref] = NULL;
}
}
-
$pParamHash['data_store']['summary'] = !empty( $pParamHash['summary'] ) ? $pParamHash['summary'] : NULL ;
// call verify service to see if any services have errors
@@ -388,10 +387,10 @@ class LibertyContent extends LibertyBase {
if( !empty( $pParamHash['content_store']['hits'] ) ) {
$this->setHits($pParamHash['content_store']['hits'], $pParamHash['content_store']['last_hit']);
}
-
// store any messages in the logs
$this->storeActionLog( $pParamHash );
+
$this->mDb->CompleteTrans();
}
return( count( $this->mErrors ) == 0 );
@@ -3077,6 +3076,7 @@ class LibertyContent extends LibertyBase {
*/
function storeActionLog( $pParamHash = NULL ) {
global $gBitSystem;
+
if( $gBitSystem->isFeatureActive( 'liberty_action_log' ) && LibertyContent::verifyActionLog( $pParamHash ) ) {
$gBitSystem->mDb->associateInsert( BIT_DB_PREFIX."liberty_action_log", $pParamHash['action_log_store'] );
}
@@ -3113,7 +3113,6 @@ class LibertyContent extends LibertyBase {
} else {
$pParamHash['action_log_store']['user_id'] = $gBitUser->mUserId;
}
-
if( !empty( $pParamHash['action_log']['title'] ) ) {
$pParamHash['action_log_store']['title'] = $pParamHash['action_log']['title'];
} elseif( !empty( $pParamHash['content_store']['title'] ) ) {
@@ -3123,7 +3122,6 @@ class LibertyContent extends LibertyBase {
} else {
$ret = FALSE;
}
-
// IP of the user
if( empty( $pParamHash['action_log']['ip'] ) ) {
if( !empty( $pParamHash['content_store']['ip'] ) ) {
@@ -3151,7 +3149,6 @@ class LibertyContent extends LibertyBase {
if( !empty( $log_message ) ) {
$pParamHash['action_log_store']['log_message'] = substr( $log_message, 0, 250 );
}
-
// error message - default is to put in any stuff in mErrors
$error_message = '';
if( empty( $pParamHash['action_log']['error_message'] ) && !empty( $this ) && !empty( $this->mErrors ) ) {
@@ -3170,7 +3167,6 @@ class LibertyContent extends LibertyBase {
if( empty( $pParamHash['action_log_store']['error_message'] ) && empty( $pParamHash['action_log_store']['log_message'] )) {
$ret = FALSE;
}
-
// if we get as far as here, we can
return $ret;
}
diff --git a/plugins/data.attachment.php b/plugins/data.attachment.php
index f8ed261..2fd6450 100644
--- a/plugins/data.attachment.php
+++ b/plugins/data.attachment.php
@@ -1,6 +1,6 @@
<?php
/**
- * @version $Revision: 1.42 $
+ * @version $Revision: 1.43 $
* @package liberty
* @subpackage plugins_data
*/
@@ -15,7 +15,7 @@
// +----------------------------------------------------------------------+
// | Authors: drewslater <andrew@andrewslater.com>
// +----------------------------------------------------------------------+
-// $Id: data.attachment.php,v 1.42 2009/10/01 14:17:01 wjames5 Exp $
+// $Id: data.attachment.php,v 1.43 2009/10/15 20:03:58 tylerbello Exp $
/**
* definitions
@@ -123,14 +123,11 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) {
$ret = tra( "The attachment id given is not valid." );
return $ret;
}
-
// we will do slightly different stuff if this is using a mime plugin
if( !empty( $att['is_mime'] )) {
global $gBitSmarty, $gLibertySystem, $gContent;
-
// convert parameters into display properties
$wrapper = liberty_plugins_wrapper_style( $pParams );
-
// work out custom display_url if there is one
if( @BitBase::verifyId( $pParams['page_id'] )) {
// link to page by page_id
@@ -184,6 +181,14 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) {
$gBitSmarty->assign( 'wrapper', $wrapper );
$gBitSmarty->assign( 'thumbsize', (( !empty( $pParams['size'] ) && ( $pParams['size'] == 'original' || !empty( $att['thumbnail_url'][$pParams['size']] ))) ? $pParams['size'] : 'medium' ));
+ //Carry only these attributes to the image tags
+ if( !empty($pParams['width']) ){
+ $gBitSmarty->assign( 'width', $pParams['width'] );
+ }
+ if( !empty($pParams['height']) ){
+ $gBitSmarty->assign( 'height', $pParams['height']);
+ }
+
$mimehandler = (( !empty( $wrapper['output'] ) && $wrapper['output'] == 'thumbnail' ) ? LIBERTY_DEFAULT_MIME_HANDLER : $att['attachment_plugin_guid'] );
$ret = $gBitSmarty->fetch( $gLibertySystem->getMimeTemplate( 'attachment', $mimehandler ));
} else {
@@ -207,11 +212,9 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) {
} else {
$alt = $wrapper['alt'];
}
-
// check if we have a valid thumbnail
if( !empty( $thumburl ) ) {
$wrapper = liberty_plugins_wrapper_style( $pParams );
-
// set up image first
$ret = '<img'.
' alt="'. $alt .'"'.
@@ -274,7 +277,6 @@ function data_attachment( $pData, $pParams, $pCommonObject, $pParseHash ) {
$ret = tra( "The attachment id given is not valid." );
}
}
-
return $ret;
}
?>
diff --git a/templates/mime/default/attachment.tpl b/templates/mime/default/attachment.tpl
index 2ba68a5..1f421f4 100644
--- a/templates/mime/default/attachment.tpl
+++ b/templates/mime/default/attachment.tpl
@@ -7,9 +7,9 @@
<{$wrapper.wrapper|default:'div'} class="{$wrapper.class|default:'att-plugin'}"{if $wrapper.style} style="{$wrapper.style}{/if}">
{if $wrapper.display_url}<a {$wrapper.href_class} href="{$wrapper.display_url}">{/if}
{if $thumbsize == 'original'}
- <img class="thumb" src="{$attachment.source_url}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" />
+ <img class="thumb" src="{$attachment.source_url}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if} />
{elseif $attachment.thumbnail_url.$thumbsize}
- <img class="thumb" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" />
+ <img class="thumb" src="{$attachment.thumbnail_url.$thumbsize}" alt="{$wrapper.alt|default:$wrapper.description|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" title="{$wrapper.description|default:$wrapper.alt|default:$attachment.filename|replace:"\r":""|replace:"\n":" "|escape}" {if !empty($height) || !empty($width)} style="{if !empty($height)}height:{$height};{/if}{if !empty($width)}width:{$width}{/if}"{/if}/>
{/if}
{if $wrapper.description_parsed}
<br />{$wrapper.description_parsed}