diff --git a/e107_admin/mailout.php b/e107_admin/mailout.php
index 62d158216..4dfc674f3 100644
--- a/e107_admin/mailout.php
+++ b/e107_admin/mailout.php
@@ -591,8 +591,11 @@ class mailout_main_ui extends e_admin_ui
'template' => vartrue($_POST['testtemplate'],null),
'shortcodes' => $this->getExampleShortcodes(),
'media' => array(
- 0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'),
- 1 => array('path' => 'h-v880sXEOQ.youtube'),
+ 0 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'),
+ 1 => array('path' => 'h-v880sXEOQ.youtube'),
+ 2 => array('path' => '{e_PLUGIN}gallery/images/horse.jpg'),
+ 3 => array('path' => '{e_PLUGIN}gallery/images/butterfly.jpg'),
+ 4 => array('path' => '{e_PLUGIN}gallery/images/horse.jpg'),
)
);
@@ -952,7 +955,7 @@ class mailout_main_ui extends e_admin_ui
$pause = e107::getConfig()->get('mail_pausetime',1);
$interval = ($pause * 1000);
- $text = e107::getForm()->progressBar('mail-progress',1, array('btn-label'=>'Start', 'interval'=>$interval, 'url'=> e_SELF, 'mode'=>$id));
+ $text = e107::getForm()->progressBar('mail-progress',0, array('btn-label'=>'Start', 'interval'=>$interval, 'url'=> e_SELF, 'mode'=>$id));
}
return $text;
diff --git a/e107_handlers/mail.php b/e107_handlers/mail.php
index c98a09828..2405b4b76 100644
--- a/e107_handlers/mail.php
+++ b/e107_handlers/mail.php
@@ -734,7 +734,27 @@ class e107Email extends PHPMailer
function processShortcodes($eml)
{
$tp = e107::getParser();
-
+
+ $mediaParms = array();
+
+
+
+ if(strpos($eml['templateHTML']['body'], '{MEDIA') !==false )
+ {
+ // check for media sizing.
+
+ if(preg_match_all('/\{MEDIA([\d]): w=([\d]*)\}/', $eml['templateHTML']['body'], $match))
+ {
+
+ foreach($match[1] as $k=>$num)
+ {
+ //$key = $match[1][$k];
+ $mediaParms[$num]['w'] = $match[2][$k];
+
+ }
+ }
+ }
+
if(!empty($eml['html']) || strip_tags($eml['template']) != $eml['template']) // HTML Email.
{
$eml['shortcodes']['BODY'] = !empty($eml['body']) ? $eml['body'] : ''; // using toEmail() on html templates adds unnecessary
to code.
@@ -747,15 +767,17 @@ class e107Email extends PHPMailer
$eml['shortcodes']['BODY'] = !empty($eml['body']) ? $eml['body'] : ''; // $tp->toEmail($eml['body']) : '';
$eml['shortcodes']['SUBJECT'] = !empty($eml['subject']) ?$eml['subject'] : '';
$eml['shortcodes']['THEME'] = ($this->previewMode == true) ? e_THEME_ABS.$this->pref['sitetheme'].'/' : e_THEME.$this->pref['sitetheme'].'/'; // Always use front-end theme path.
-
-
+
+
+
if(!empty($eml['media']) && is_array($eml['media']))
{
foreach($eml['media'] as $k=>$val)
{
if(vartrue($val['path']))
{
- $id = 'MEDIA'.($k+1);
+ $nk = ($k+1);
+ $id = 'MEDIA'.$nk;
if($tp->isVideo($val['path']))
{
@@ -763,7 +785,9 @@ class e107Email extends PHPMailer
}
else
{
- $eml['shortcodes'][$id] = "
";
+ $size = isset($mediaParms[$nk]) ? "?w=".$mediaParms[$nk]['w'] : '';
+ //echo $nk.": ".$val['path'].$size."
";
+ $eml['shortcodes'][$id] = "";
}
}
@@ -809,7 +833,7 @@ class e107Email extends PHPMailer
if($tmpl = e107::getCoreTemplate('email', $eml['template'], 'front', true)) //FIXME - Core template is failing with template 'notify'. Works with theme template. Issue with core template registry?
{
-
+ $eml['templateHTML'] = $tmpl;
$eml['shortcodes'] = $this->processShortcodes($eml);
$emailBody = $tmpl['header']. str_replace('{BODY}', $eml['body'], $tmpl['body']) . $tmpl['footer'];
@@ -1118,12 +1142,21 @@ class e107Email extends PHPMailer
{
$url = $tp->replaceConstants($url);
+ $size = 'w=800';
+
+ if(strpos($url, '?w=')!==false)
+ {
+ list($url,$size) = explode('?', $url);
+ }
+
// resize on the fly.
if($this->debug)
{
echo "
Attempting Resize...".$url;
+
}
- if($resized = e107::getMedia()->resizeImage($url, e_TEMP.basename($url),'w=800'))
+ // e107::getMessage()->addInfo("Resizing: ".$url." to ".$size);
+ if($resized = e107::getMedia()->resizeImage($url, e_TEMP.basename($url), $size))
{
$url = $resized;
}
diff --git a/e107_plugins/gallery/controllers/index.php b/e107_plugins/gallery/controllers/index.php
index 9ccaf7c68..2fdd0723d 100644
--- a/e107_plugins/gallery/controllers/index.php
+++ b/e107_plugins/gallery/controllers/index.php
@@ -67,6 +67,7 @@ class plugin_gallery_index_controller extends eControllerFront
public function init()
{
e107::plugLan('gallery', 'front');
+ e107::css('gallery', 'css/gallery.css');
$this->catList = e107::getMedia()->getCategories('gallery');
}
diff --git a/thumb.php b/thumb.php
index bc2b95e05..3694c7932 100644
--- a/thumb.php
+++ b/thumb.php
@@ -48,6 +48,10 @@ exit;
class e_thumbpage
{
+ private $_debug = false;
+
+ private $_cache = true;
+
/**
* Page request
* @var array
@@ -232,7 +236,13 @@ class e_thumbpage
$parm = array('size' => $width."x".$height);
$this->placeholder($parm);
- return;
+ return false;
+ }
+
+ if($this->_debug === true)
+ {
+ var_dump($this->_request);
+ // return false;
}
if(!$this->_src_path)
@@ -246,17 +256,19 @@ class e_thumbpage
$cache_str = md5(serialize($options). $this->_src_path. $this->_thumbQuality);
$fname = strtolower('Thumb_'.$thumbnfo['filename'].'_'.$cache_str.'.'.$thumbnfo['extension']).'.cache.bin';
-
- if(is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname))
+
+ if($this->_cache = true && is_file(e_CACHE_IMAGE.$fname) && is_readable(e_CACHE_IMAGE.$fname) && ($this->_debug !== true))
{
$thumbnfo['lmodified'] = filemtime(e_CACHE_IMAGE.$fname);
$thumbnfo['md5s'] = md5_file(e_CACHE_IMAGE.$fname);
$thumbnfo['fsize'] = filesize(e_CACHE_IMAGE.$fname);
// Send required headers
- $this->sendHeaders($thumbnfo);
-
+ if($this->_debug !== true)
+ {
+ $this->sendHeaders($thumbnfo);
+ }
//$bench->end()->logResult('thumb.php', $_GET['src'].' - 304 not modified');
// exit;
@@ -278,11 +290,15 @@ class e_thumbpage
}
// TODO - wrap it around generic e107 thumb handler
+ if($this->_debug === true)
+ {
+ $start = microtime(true);
+ }
@require(e_HANDLER.'phpthumb/ThumbLib.inc.php');
try
{
$thumb = PhpThumbFactory::create($this->_src_path);
- $sizeUp = ($this->_request['w'] > 110) ? true : false; // don't resizeUp the icon images.
+ $sizeUp = ($this->_request['w'] > 110 || $this->_request['aw'] > 110) ? true : false; // don't resizeUp the icon images.
$thumb->setOptions(array(
'correctPermissions' => true,
'resizeUp' => $sizeUp,
@@ -300,16 +316,26 @@ class e_thumbpage
if(isset($this->_request['w']) || isset($this->_request['h']))
{
$thumb->resize((integer) vartrue($this->_request['w'], 0), (integer) vartrue($this->_request['h'], 0));
+ echo __LINE__;
}
- elseif(vartrue($this->_request['ah']))
+ elseif(!empty($this->_request['ah']))
{
//Typically gives a better result with images of people than adaptiveResize().
- //TODO TBD Add Pref for Top, Bottom, Left, Right, Center?
- $thumb->adaptiveResizeQuadrant((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0), 'T');
+ //TODO TBD Add Pref for Top, Bottom, Left, Right, Center?
+ $thumb->adaptiveResizeQuadrant((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0), 'T');
}
else
{
- $thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
+ $thumb->adaptiveResize((integer) vartrue($this->_request['aw'], 0), (integer) vartrue($this->_request['ah'], 0));
+ }
+
+
+ if($this->_debug === true)
+ {
+ echo "time: ".round((microtime(true) - $start),4);
+
+ var_dump($thumb);
+ return false;
}
// Watermark Option - See admin->MediaManager->prefs for details.
@@ -327,13 +353,15 @@ class e_thumbpage
$thumb->WatermarkText($this->_watermark);
}
// echo "hello";
-
+
+
//exit;
// set cache
$thumb->save(e_CACHE_IMAGE.$fname);
+
// show thumb
$thumb->show();