Skip to content

Commit

Permalink
Intermediate step 3: limit qty of previewed orphan-pictures by config
Browse files Browse the repository at this point in the history
Signed-off-by: Taggic <taggic@t-online.de>
  • Loading branch information
Taggic committed Feb 5, 2012
1 parent f24fc12 commit 4490a3d
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2012-02-02
2012-02-05
6 changes: 6 additions & 0 deletions conf/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php
/**
* Options for the orphanmedia plugin
*/

$conf['prev_limit'] = '10'; // limits the preview of orphanned pictures
9 changes: 9 additions & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* Metadata for configuration manager plugin
* Additions for the orphanmedia plugin
*
* @author Taggic@t-online.de
*/

$meta['prev_limit'] = array('string'); // limits the preview of orphanned pictures
9 changes: 9 additions & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
/**
* English language file for orphanmedia plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Taggic@t-online.de
*/

$lang['prev_limit'] = 'max quantity of pictures to be previewed';
2 changes: 1 addition & 1 deletion plugin.info.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
base orphanmedia
author Taggic
email Taggic@t-online.de
date 2012-02-02
date 2012-02-05
name OrphanMedia Plugin
desc Display orphan and missing media files.
'url' => 'http://dokuwiki.org/plugin:orphanmedia',
8 changes: 4 additions & 4 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
require_once(DOKU_INC.'inc/search.php');
include(DOKU_INC.'inc/JpegMeta.php');
/******************************************************************************
* All DokuWiki plugins to extend the parser/rendering mechanism
* need to inherit from this class
Expand Down Expand Up @@ -217,7 +216,7 @@ function render($format, &$renderer, $data) {
$style = '';
$w_max = 200;
$h_max = 75;
if (preg_match("/\.(jpe?g|gif|png)$/", $m_link) && file_exists($m_link)) {
if ((preg_match("/\.(jpe?g|gif|png)$/", $m_link) && file_exists($m_link)) && ($prviewcounter<$this->getConf('prev_limit'))) {
$minfo = getimagesize($m_link);
$w = (int) $minfo[0];
$h = (int) $minfo[1];
Expand All @@ -234,10 +233,11 @@ function render($format, &$renderer, $data) {
$h = floor($h * $ratio);
}
}
$style = ' style="width: '.$w.'px; height: '.$h.'px;"';
$prviewcounter++;
//$style = ' style="width: '.$w.'px; height: '.$h.'px;"';
$picturepreview = '<a href="' . DOKU_URL . 'lib/exe/detail.php?media=' . $rt2
. '" class="media" title="'. $listMediaFiles[0][$position]
. '"><img src="'. DOKU_URL . 'lib/exe/fetch.php?media=' . $rt2
. '"><img src="'. DOKU_URL . 'lib/exe/fetch.php?media=' . $rt2 .'&w='.$w.'&h='.$h
. '" class="media" ' .$style. 'alt="' . $listMediaFiles[0][$position] .'" /></a>';
}
else {
Expand Down

0 comments on commit 4490a3d

Please sign in to comment.