Home > > SemanticScuttle のサムネイルをキャッシュしたりするパッチ

SemanticScuttle のサムネイルをキャッシュしたりするパッチ

  • 2008-08-22 (Fri) 04:35
semanticscuttle.png

 SemanticScuttle とゆー,ソーシャルブックマークを自前のサーバでサービスするためのオープンソースアプリケーションがあるんですわ。
MOONGIFT: » さらに便利に使いやすく「SemanticScuttle」:オープンソースを毎日紹介

 サムネイル (ブックマークのリンク先のスクリーンショット) 作成が遅い上にキャッシュしてくれないので,そこらへんをごにょごにょしたりするパッチを作成してみた。

変更点の概要

  • サムネイル取得先を変更した
  • サムネイルのサイズを指定できるようにした
  • サムネイルをキャッシュするようにした (1 日 1 回のみ更新)
  • $useredir の設定が true の時に,表示から $url_redir のみ削除するようにした (Scuttle と同じ振る舞い)
  • タグのリネーム時に処理が進まない障害を Fix (このパッチは配布元に投稿済み)

ダウンロード

SemanticScuttle (Subversion r137 + パッチ)
パッチ済みフルパッケージ (tar.gz)

差分

 以下の差分の他に,新たに追加した getimage.php が必要。フルパッケージの中には入ってます。


diff -ru ../semanticscuttle_r137/config.inc.php.example ./config.inc.php.example
--- ../semanticscuttle_r137/config.inc.php.example	2008-06-01 22:17:54.000000000 +0900
+++ ./config.inc.php.example	2008-08-22 03:37:04.000000000 +0900
@@ -68,6 +68,8 @@
 $enableCommonBookmarkDescription = true; # enableCommonBookmarkDescription {true,false}
 $enableWebsiteThumbnails = true; # enableWebsiteThumbnails {true|false}
 # According to artviper.net license, buy a license if you gain profit with your pages. (see http://www.websitethumbnail.de/)
+# $websiteThumbnailsWidth = 90;
+# $websiteThumbnailsHeight = 68;
 
 
 ### Tags ###
Only in .: getimage.php
diff -ru ../semanticscuttle_r137/scuttle.css ./scuttle.css
--- ../semanticscuttle_r137/scuttle.css	2008-05-14 17:58:48.000000000 +0900
+++ ./scuttle.css	2008-08-22 03:28:38.000000000 +0900
@@ -177,7 +177,7 @@
     padding: 1px;
     margin-right: 6px;
     margin-bottom:4px;
-    border:1px solid #AAA;
+    /* border:1px solid #AAA; */
 }
 div.link a {
     color: blue;
diff -ru ../semanticscuttle_r137/tagrename.php ./tagrename.php
--- ../semanticscuttle_r137/tagrename.php	2008-04-22 00:43:00.000000000 +0900
+++ ./tagrename.php	2008-08-22 03:28:45.000000000 +0900
@@ -43,7 +43,6 @@
    if (
       !is_null($old) &&
       !is_null($new) &&
-      $tagservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
       $b2tservice->renameTag($userservice->getCurrentUserId(), $old, $new) &&
       $tag2tagservice->renameTag($userservice->getCurrentUserId(), $old, $new)
    ) {
diff -ru ../semanticscuttle_r137/templates/bookmarks.tpl.php ./templates/bookmarks.tpl.php
--- ../semanticscuttle_r137/templates/bookmarks.tpl.php	2008-05-14 17:55:38.000000000 +0900
+++ ./templates/bookmarks.tpl.php	2008-08-22 04:30:45.000000000 +0900
@@ -190,10 +190,20 @@
         
         // Output
         echo '<li class="xfolkentry'. $access .'">'."\n";
-	if ($GLOBALS['enableWebsiteThumbnails']) {
-	    echo '<a href="'. $address .'"'. $rel .' ><img class="thumbnail" src="http://www.artviper.net/screenshots/screener.php?sdx=1024&sdy=768&w=90&h=68&url='.$address.'"></a>';
-	}
-	echo '<div>';
+        if ($GLOBALS['enableWebsiteThumbnails']) {
+            $original_address = str_replace($GLOBALS['url_redir'], "", $address);
+            $getimage_url = createURL('getimage', '?url=' . urldecode($original_address));
+            if ($GLOBALS['websiteThumbnailsWidth'] > 0 && $GLOBALS['websiteThumbnailsHeight'] > 0) {
+                $width = $GLOBALS['websiteThumbnailsWidth'];
+                $height =  $GLOBALS['websiteThumbnailsHeight'];
+            } else {
+                $width = 90;
+                $height = 68;
+            }
+            echo '<a href="'. $address .'"'. $rel .' ><img class="thumbnail" src="' . $getimage_url
+                . '" height="' . $height . '" width="' . $width . '"></a>';
+        }
+        echo '<div>';
 
         echo '<div class="link"><a href="'. $address .'"'. $rel .' class="taggedlink">'. filter($row['bTitle']) ."</a></div>\n";
         if ($row['bDescription'] == '') {
@@ -201,7 +211,8 @@
         }
         echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
 	if(!isset($hash)) {
-	    echo '<div class="address">'.shortenString($address).'</div>';
+        $original_address = str_replace($GLOBALS['url_redir'], "", $address);
+	    echo '<div class="address">'.shortenString($original_address).'</div>';
 	}
 
         echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
reCAPTCHA Public Key is not set.

Trackback:No Trackbacks

TrackBack URL for this entry
http://kagura-c.info/blog_old/action.php?action=plugin&name=TrackBack&tb_id=99
Listed below are links to weblogs that reference
SemanticScuttle のサムネイルをキャッシュしたりするパッチ from Clothoの弱電録

トラックバック
このエントリにトラックバックはありません
このトラックバックURLを使ってこの記事にトラックバックを送ることができます。 もしあなたのブログがトラックバック送信に対応していない場合にはこちらのフォームからトラックバックを送信することができます。.

Home > > SemanticScuttle のサムネイルをキャッシュしたりするパッチ

Search
Feeds

Page Top