discuz プラグインについては、組織の力を信じてもう一度 csdn に聞きに行きました。
このプラグインはTiebaを模倣したもので、投稿一覧にサムネイルを表示するもので、X3.0に最適なスタイルですが、クライアント側ではX2.5しか使えません。このプラグインは X2 で利用できますが、X2.5 環境で動作するようにコードを変更したいだけです。商用目的ではありません。
X3.0では、サムネイルを保存するフォルダーを生成し、その中にサムネイルを保存できます。しかし、2.5 ではこのフォルダーが見つからなかったので、ビルド ステップで何か問題が発生したように感じました。
thumbbuilder.class.php ファイルのコードは以下に掲載されています。専門家は、tiebalist フォルダーが data/attachment/ の下に生成されない理由を分析してください。
<?phpif(!defined('IN_DISCUZ')) { exit('Access Denied');}if (!class_exists('PhpThumbFactory',false)) require_once('source/plugin/chs_tiebalist/phpthumb/ThumbLib.inc.php');class ThumbBuilder { private $basedir; private $baseurl; public function __construct(){ global $_G; $this->basedir=!$_G['setting']['attachdir'] ? (DISCUZ_ROOT.'data/attachment/'):$_G['setting']['attachdir']; $this->baseurl=!$_G['setting']['attachurl'] ? ('data/attachment/'):$_G['setting']['attachurl']; } private function getCoverPath($tid){ return 'tiebalist/'.substr(md5($tid), 0, 2).'/'.substr(md5($tid), 2, 2).'/'; } public function GetThreadCovers($tid,$aids){ $coverpath=$this->getCoverPath($tid); $fullpath=$this->basedir.$coverpath; $fullurl=$this->baseurl.$coverpath; $images=array(); foreach($aids as $aid){ if (file_exists($fullpath.$aid.'.jpg')) $images[]=array('aid'=>$aid,'thumbfile'=>$fullurl.$aid.'.jpg'); } return $images; } public function CreateThreadCovers($tid,$images,$force=0){ $path=$this->basedir.$this->getCoverPath($tid); dmkdir($path); global $_G; $setting=&$_G['cache']['plugin']['chs_tiebalist']; $thumbheight=$setting['thumbheight']?$setting['thumbheight']:80; $thumbmaxwidth=$setting['thumbmaxwidth']?$setting['thumbmaxwidth']:300; foreach($images as $aid=>$image){ $target=$path.$aid.'.jpg'; if (file_exists($target)&&(!$force)) continue; try { $thumb = PhpThumbFactory::create($image,array('resizeUp'=>true)); $dimensions=$thumb->getCurrentDimensions(); $newwidth=$thumbheight*$dimensions['width']/$dimensions['height']; if ($newwidth>$thumbmaxwidth) { $thumb->adaptiveResize($thumbmaxwidth,$thumbheight); }else { $thumb->resize(0,$thumbheight);//封面不限定宽度 } $thumb->save($target); }catch(Exception $oEx){//捕获生成缩略图可能抛出的异常,防止中断 writelog('tiebalistlog',$oEx->getMessage()); continue; } } if ($force) { $thumbfiles=$this->getfiles($path,'jpg'); $aids=array_keys($images); foreach($thumbfiles as $filename){ $aid=intval(substr($filename,0,strpos($filename,'.'))); if (!in_array($aid,$aids)) unlink($path.$filename); } } } private function getfiles($dir,$mask=''){ $fileArray=array(); if (false != ($handle = opendir ($dir))) { while (false!==($file=readdir($handle))){ if ($file == '.' || $file == '..') continue; if (empty($mask)) $fileArray[]=$file; else if (substr(strrchr($file, '.'), 1)==$mask) $fileArray[]=$file; } } return $fileArray; }}?>
ディスカッション (解決策) への返信
buildthumb.inc.php の内容も役に立ちそうです
<?phpif(!defined('IN_DISCUZ')) { exit('Access Denied');}class plugin_chs_tiebalist { function common() {}}class plugin_chs_tiebalist_forum extends plugin_chs_tiebalist { function forumdisplay_thread_subject_output(){ global $_G; $setting=&$_G['cache']['plugin']['chs_tiebalist']; if (!$setting['enabled']) return; $fid = intval($_G['fid']); $forumselected=unserialize($setting['forumselected']); if(!in_array($fid,$forumselected)) return; if ($_G['forum']['picstyle'] == 0||$_G['cookie']['forumdefstyle']==1){ global $_G; $threadlist = array(); $threadlist = $_G['forum_threadlist']; $tiebalist = array(); $messagelength=$setting['messagelength']?$setting['messagelength']:100; $picturenum=$setting['$picturenum']?$setting['$picturenum']:3; include libfile('function/post'); require_once('thumbbuilder.class.php'); $oTB=new ThumbBuilder(); foreach($threadlist as $key => $value){ $position=($value['special']==2)?2:1;//商品主题的首帖在第二楼,回复从第3楼开始 $firstpost=C::t('forum_post')->fetch_all_by_tid_position('tid:'.$value['tid'],$value['tid'],$position); if (count($firstpost)>0&&$firstpost[0]['invisible']>=0){ $post=&$firstpost[0]; $message=messagecutstr($post['message'],$messagelength); $tiebalist[$key] = '<p>'.$message.'</p>'; $attachs=C::t('forum_attachment_n')->fetch_all_by_id('pid:'.$post['pid'],'pid',$post['pid'],false,true,false,false,$picturenum); $aids=array_keys($attachs); if ($aids){ $imagelist=$oTB->GetThreadCovers($value['tid'],$aids); if (count($imagelist)>0) { $tiebalist[$key].='<ul id="thumblist_'.$value['tid'].'" class="thumblist cl">'; foreach($imagelist as $ii=>$image){ $attach=$attachs[$image['aid']]; $forumimg=($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment']; $tiebalist[$key].='<li data="'.$forumimg.'" onclick="showpicture('.$value['tid'].','.$ii.');return false;"><img src="'.$image['thumbfile'].'"/></li>'; } $tiebalist[$key].='</ul>'; $tiebalist[$key].= '<div id="picturebox_'.$value['tid'].'" class="picturedisplay" style="display:none;"> <div class="picturecontrol"> <a class="icon_close" onclick="closepicture('.$value['tid'].');return false;">收起</a> <span>|</span> <a class="icon_viewpost" href="forum.php?mod=viewthread&tid='.$value['tid'].'&extra=page%3D1">查看帖子</a> <span>|</span> <a class="icon_turnleft" onclick="turnimg('.$value['tid'].',1);return false;">左转</a> <span>|</span> <a class="icon_turnright" onclick="turnimg('.$value['tid'].',0);return false;">右转</a> </div> <div class="picturewrap" > <a onclick="closepicture('.$value['tid'].');return false;"><img class="picture" src="" /></a> <div class="goprevious"></div> <div class="gonext"></div> </div> </div>'; } } } } return $tiebalist; } } function forumdisplay_threadlist_bottom() { global $_G; $setting=&$_G['cache']['plugin']['chs_tiebalist']; if (!$setting['enabled']) return; $fid = intval($_G['fid']); $forumselected=unserialize($setting['forumselected']); if(!in_array($fid,$forumselected)) return; $echo = '<link rel="stylesheet" type="text/css" href="source/plugin/chs_tiebalist/template/css/tiebalist.css" />'; $echo .= '<script src="source/plugin/chs_tiebalist/template/js/tiebalist.js" type="text/javascript"></script>'; $picturemaxwidth=$setting['picturemaxwidth']?$setting['picturemaxwidth']:600; $echo .='<script type="text/javascript">var picturemaxwidth='.$picturemaxwidth.';</script>'; return $echo; } function post_chs_tiebalist_message($params) { global $_G, $tid, $pid, $modthread, $isfirstpost; $setting=&$_G['cache']['plugin']['chs_tiebalist']; if (!$setting['enabled']) return; $fid = intval($_G['fid']); $forumselected=unserialize($setting['forumselected']); if(!in_array($fid,$forumselected)) return; list($msg, $url_forward, $values, $extraparam) = $params['param']; if (($msg == 'post_newthread_succeed')||($msg == 'post_newthread_mod_succeed')) { $pid = $modthread->pid; $this->create_covers($pid,$tid); dshowmessage($msg, $url_forward, $values, $extraparam); }else if (($msg == 'post_edit_succeed')&&$isfirstpost) { $tid=$_G['tid']; $this->create_covers($pid,$tid); dshowmessage($msg, $url_forward, $values, $extraparam); } } private function create_covers($pid,$tid){ global $_G; $setting=&$_G['cache']['plugin']['chs_tiebalist']; $picturenum=$setting['$picturenum']?$setting['$picturenum']:3; //获取帖子的图片 $attachs=C::t('forum_attachment_n')->fetch_all_by_id('pid:'.$pid,'pid',$pid,false,true,false,false,$picturenum); $images=array(); foreach($attachs as $attach){ $images[$attach['aid']]=($attach['remote'] ? $_G['setting']['ftp']['attachdir'] : $_G['setting']['attachdir']).'forum/'.$attach['attachment']; } if ($images){ require_once("thumbbuilder.class.php"); $oTB=new ThumbBuilder(); $oTB->CreateThreadCovers($tid,$images); } }}?>
オリジナルのプラグイン作者を見つけて見てください!

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック

PyCharm は、開発者がより効率的にコードを記述できるようにする豊富な機能とツールを提供する、強力で人気のある Python 統合開発環境 (IDE) です。 PyCharm のプラグイン機構は、機能を拡張するための強力なツールであり、さまざまなプラグインをインストールすることで、PyCharm にさまざまな機能やカスタマイズ機能を追加できます。したがって、PyCharm の初心者にとって、プラグインのインストールを理解し、習熟することが重要です。この記事では、PyCharm プラグインの完全なインストールについて詳しく説明します。
![Illustrator でのプラグインの読み込みエラー [修正]](https://img.php.cn/upload/article/000/465/014/170831522770626.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
Adobe Illustrator を起動すると、プラグインの読み込みエラーに関するメッセージが表示されますか?一部の Illustrator ユーザーは、アプリケーションを開いたときにこのエラーに遭遇しました。メッセージの後には、問題のあるプラグインのリストが続きます。このエラー メッセージは、インストールされているプラグインに問題があることを示していますが、Visual C++ DLL ファイルの破損や環境設定ファイルの破損など、他の理由によって発生する可能性もあります。このエラーが発生した場合は、この記事で問題を解決する方法を説明しますので、以下を読み続けてください。 Illustrator でのプラグインの読み込みエラー Adobe Illustrator を起動しようとしたときに「プラグインの読み込みエラー」エラー メッセージが表示された場合は、次の操作を行うことができます。 管理者として

Chrome プラグイン拡張機能のインストール ディレクトリとは何ですか?通常の状況では、Chrome プラグイン拡張機能のデフォルトのインストール ディレクトリは次のとおりです。 1. WindowsXP での Chrome プラグインのデフォルトのインストール ディレクトリの場所: C:\DocumentsandSettings\username\LocalSettings\ApplicationData\Google\Chrome\UserData\ Default\Extensions2. Windows7 の chrome プラグインのデフォルトのインストール ディレクトリの場所: C:\Users\username\AppData\Local\Google\Chrome\User

ユーザーが Edge ブラウザを使用する場合、より多くのニーズを満たすためにいくつかのプラグインを追加する場合があります。しかし、プラグインを追加すると、このプラグインはサポートされていないと表示されます。この問題を解決するにはどうすればよいですか?今日は編集者が 3 つの解決策を紹介しますので、ぜひ試してみてください。方法 1: 別のブラウザを使用してみてください。方法 2: ブラウザ上の Flash Player が古いか見つからないため、プラグインがサポートされていない可能性があり、公式 Web サイトから最新バージョンをダウンロードできます。方法3:「Ctrl+Shift+Delete」キーを同時に押します。 「データを消去」をクリックしてブラウザを再度開きます。

PyCharm Community Edition は十分なプラグインをサポートしていますか?特定のコード例が必要 ソフトウェア開発の分野で Python 言語がますます広く使用されるようになるにつれて、プロ仕様の Python 統合開発環境 (IDE) として PyCharm が開発者に好まれています。 PyCharmはプロフェッショナル版とコミュニティ版の2つのバージョンに分かれており、コミュニティ版は無料で提供されますが、プラグインのサポートがプロフェッショナル版に比べて制限されています。そこで問題は、PyCharm Community Edition は十分なプラグインをサポートしているかということです。この記事では、具体的なコード例を使用して、

WordPress プラグインを使用してインスタント位置情報機能を実現する方法 モバイルデバイスの普及に伴い、ますます多くの Web サイトが位置情報ベースのサービスを提供し始めています。 WordPress Web サイトでは、プラグインを使用して即時測位機能を実装し、訪問者に地理的位置に関連するサービスを提供できます。 1. 適切なプラグインを選択する WordPress プラグイン ライブラリには、地理位置情報サービスを提供する多くのプラグインから選択できます。ニーズと要件に応じて、適切なプラグインを選択することが、即時測位機能を実現する鍵となります。ここにいくつかあります

WeChat ミニ プログラム機能を WordPress プラグインに追加する方法 WeChat ミニ プログラムの人気と人気に伴い、ますます多くの Web サイトやアプリケーションが WeChat ミニ プログラムとの統合を検討し始めています。コンテンツ管理システムとして WordPress を使用している Web サイトの場合、WeChat アプレット機能を追加すると、ユーザーはより便利なアクセス エクスペリエンスとより多くの機能の選択肢を提供できます。この記事では、WordPress プラグインに WeChat ミニプログラム機能を追加する方法を紹介します。ステップ 1: WeChat ミニ プログラム アカウントを登録する. まず、WeChat アプリを開く必要があります

WordPress プラグインを使用してビデオ再生機能を実装する方法 1. はじめに Web サイトやブログでビデオを適用することがますます一般的になってきています。高品質のユーザーエクスペリエンスを提供するために、WordPress プラグインを使用してビデオ再生機能を実装できます。この記事では、WordPress プラグインを使用してビデオ再生機能を実装する方法とコード例を紹介します。 2. プラグインを選択する WordPress には、選択できるビデオ再生プラグインが多数あります。プラグインを選択するときは、次の点を考慮する必要があります。 互換性: プラグインが適切であることを確認してください。
