• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision0da9c2b8636ade0a29c5392fe43f5801fa221c67 (tree)
Time2006-10-07 11:26:30
Authorhsur <hsur@1ca2...>
Commiterhsur

Log Message

v1.0の内容をマージ

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@428 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- a/trunk/NP_TrimImage/NP_TrimImage.php
+++ b/trunk/NP_TrimImage/NP_TrimImage.php
@@ -11,6 +11,7 @@
1111 // 0.7: supports templatevar
1212 // supports <%popup()%>
1313 // 0.8: supports gif
14+// 0.9 doTemplateVar calls DB data for other PreItem Plugin
1415 // 0.9: change '&' to '&amp;'
1516
1617 class NP_TrimImage extends NucleusPlugin
@@ -26,16 +27,14 @@ class NP_TrimImage extends NucleusPlugin
2627 return 'nakahara21';
2728 }
2829
29- function getURL ()
30- {
31- return 'http://nakahara21.com';
30+ function getURL () {
31+ return 'http://nakahara21.com/';
3232 }
33-
34- function getVersion ()
35- {
36- return '0.9';
33+
34+ function getVersion () {
35+ return '1.0';
3736 }
38-
37+
3938 function supportsFeature($what)
4039 {
4140 switch ($what) {
@@ -221,16 +220,18 @@ class NP_TrimImage extends NucleusPlugin
221220 function baseimageCreate($p,$imgtype)
222221 {
223222 switch ($imgtype) {
223+ case 1:
224+ return ImageCreateFromGif($p);
224225 case 2:
225- return ImageCreateFromJpeg($p);
226+ return ImageCreateFromJpeg($p);
226227 case 3:
227- return ImageCreateFromPng($p);
228+ return ImageCreateFromPng($p);
228229 default:
229- return;
230+ return;
230231 }
231232 }
232233
233- function doTemplateVar(&$item, $wsize=80, $hsize=80, $point=0)
234+ function doTemplateVar(&$item, $wsize=80, $hsize=80, $point=0, $maxAmount=0){
234235 {
235236 global $CONF;
236237 if ($hsize=='') $hsize = 80;
@@ -240,7 +241,14 @@ class NP_TrimImage extends NucleusPlugin
240241 $filelist = array();
241242 $this->imglists = array();
242243 $this->imgfilename = array();
243- $txt = $item->body.$item->more;
244+// $txt = $item->body.$item->more;
245+ $txt = '';
246+ $q = 'SELECT ibody as body, imore as more FROM '.sql_table('item').' WHERE inumber='.intval($item->itemid);
247+ $r = sql_query($q);
248+ while ($d = mysql_fetch_object($r)) {
249+ $txt .= $d->body.$d->more;
250+ }
251+
244252 preg_match_all("/\<\%image\((.*)\)\%\>/Us", $txt, $imgipnt, PREG_PATTERN_ORDER);
245253 @array_walk($imgipnt[1], array(&$this, "exarray"), array($item->itemid, $item->authorid));
246254 preg_match_all("/\<\%popup\((.*)\)\%\>/Us",$txt,$imgipntp, PREG_PATTERN_ORDER);
@@ -248,7 +256,10 @@ class NP_TrimImage extends NucleusPlugin
248256
249257 $filelist = $this->imglists;
250258 // print_r($filelist);
251- $amount = count($filelist);
259+ if(!$maxAmount)
260+ $amount = count($filelist);
261+ else
262+ $amount = min($maxAmount, count($filelist));
252263
253264 // echo '<div style="text-align:center;padding:3px;">';
254265
Show on old repository browser