Car for Life

หมวดไฟฟ้าทั่วไป อิเล็กทรอนิกส์ คอมพิวเตอร์ => ห้องคอมพิวเตอร์ => SMF => ข้อความที่เริ่มโดย: Auto Car ที่ 04 พฤษภาคม 2021, 14:31:45

หัวข้อ: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 04 พฤษภาคม 2021, 14:31:45
Thumbnail Topic Mod เป็นเวอร์ชั่น 4.0
https://custom.simplemachines.org/mods/index.php?mod=1151
    แต่ว่าเมื่อติดตั้งไปแล้ว ไม่ว่าจะใส่รูปเข้าไปในกระทู้ ก็ยังไม่แสดง จะแนบรูปในกระทู้ก็ยังเฉย
ไม่รู้เป็นที่อะไร ในเว็บเก่าก็เป็นเหมือนกัน แปลกๆ เน๊อะ

    หรือเป็น Server หรือเปล่า เพราะแปลกๆ อยู่ที่ Login Directadmin ก็ไม่ได้
สองสามอาการนี้ น่าจะเกียวกับระบบเซิฟเวอร์แน่เลย

มีคอมมูนิตี้ ด้วยที่นี่...
https://www.simplemachines.org/community/index.php?topic=232539.0

เว็บนี้ มีคำอธิบายได้แจ๋วมาก หน้า 2 เด้อ
http://www.justusers.net/forum/index.php/topic,3798.15.html

เราโพสต์ถามหน้า 4
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 04 พฤษภาคม 2021, 14:46:12
 พยายามหาข้อมูลประกอบการแก้ไข ไปเจอที่
http://www.justusers.net/forum/index.php/topic,3798.0.html

ข้อดี ม็อดตัวนี้ไม่ต้องตั้งค่า ลงเสร็จแสดงผลเลย (ถ้าผ่าน) ไม่มีแก้ภาษาแม้อักษรเดียว
แต่ทำไมของเร มันไม่ขึ้นสักกะติ๊ดเลย

ถ้าใช้ธีมอื่นนอกจากดีฟอลด์  ต้องทำมือ ลงอัตโนมัติอาจจะผ่าน แต่ไม่แสดงผล
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 04 พฤษภาคม 2021, 14:48:11
เอาหละ 

ม็อดตัวนี้มันยังมีที่ไม่สมบูรณ์อยู่บ้าง

1.ถ้าการแสดงผลหน้าลีสต์ ย่อรูปได้ปกติ ก็ถือว่าผ่าน    แต่ขนาดไบต์ของรูป จะเท่ากับขนาดไฟล์จริงที่อยู่ในแนบกระทู้
  ส่งผลอะไร
  - แบนวิท เช่น กระทู้แนบ 100 เค  หนึ่งหน้าลีสต์มี 20 กระทู้  ก็โดนไปละ  2 เม็ก ต่อการเข้าชม 1 ครั้ง
  - อืด-หน่วง สำหรับเน็ตช้าก็คงเป็นปัญหาบ้าง ถ้าเน็ตไวก็ไม่เห็นผลกระทบ
  ** แก้ปัญหา  ลดจำนวนลีสต์กระทู้ในหนึ่งหน้าให้น้อยลง  10-15 ก็น่าจะพอ

2. ข้อดี ม็อดตัวนี้ไม่ต้องตั้งค่า ลงเสร็จแสดงผลเลย (ถ้าผ่าน) ไม่มีแก้ภาษาแม้อักษรเดียว

3. ถ้าใช้ธีมอื่นนอกจากดีฟอลด์  ต้องทำมือ ลงอัตโนมัติอาจจะผ่าน แต่ไม่แสดงผล

4. รูปหน้าลีสต์กระทู้ ไม่แสดงแบบ Thumbnail  แต่ดันมโหฬารเท่าไฟล์แนบ
   * แก้ปัญหาแบบที่ 1  ไปตั้งค่าการจัดการไฟล์แนบให้ย่อรูป  ผู้จัดการระบบไฟล์แนบ / เปลี่ยนขนาดรูปภาพเมื่อแสดงใต้กระทู้:
      จะเอาเท่าไหร่ก็ระบุไป 
      แต่ข้อเสียคือ  บางบอร์ดก็ไม่ได้ผล  แม้ได้ผล รูปในกระทู้ก็เล็กกระจึ๋งนึง
   
   * แก้ปัญหาแบบที่ 2 น่าจะเวิร์คสุดละ 
     หลังจากติดตั้งแล้ว ให้ไปแก้ไฟล์  MessageIndex.template.php

จากเดิม 

โค๊ด: [เลือก]
// Thumbnail Topic Mod
      if ($context['show_thumbnails'])            {               echo '<td class="windowbg2" valign="middle" align="center">';                  $imagefound = false;                  foreach ($topic['image'] as $image)                  {                     if ($imagefound == true)                        break;                     if (isset($image['id']))                     {                        echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';                        $imagefound = true;                     }                  }               echo '</td>';            }                        
      // End Thumbnail Topic Mod
   



ตรงนี้   

<img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'],


ให้ใส่เลขเข้าไป ตามพิกเซลที่ต้องการ

<img src="', $image['url'], '" width=80"', $image['width'], '" height=60"', $image['height'],


(http://www.justusers.net/forum/index.php?action=dlattach;topic=3798.0;attach=694;image)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 05 พฤษภาคม 2021, 06:58:14
แก้ไขไฟล์อะไรบ้าง
 มาเริ่มไฟล์แรกกันเลย
./Sources/MessageIndex.php

Find :
โค๊ด: You are not allowed to view links. Register or Login
// Grab the appropriate topic information...
if (!$pre_query || !empty($topic_ids))

Add After :
โค๊ด: You are not allowed to view links. Register or Login

// Thumbnail Topic Mod
if (isset($modSettings['photo_boards']))
$modSettings['photo_boards'] = explode(',', $modSettings['photo_boards']);
else
$modSettings['photo_boards'] = array($board);

// Used to decide if we thumbnails are shown on this topic listing page
$context['show_thumbnails'] = false;

// End Thumbnail Topic Mod

Find :
โค๊ด: You are not allowed to view links. Register or Login
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '
Replace with :
โค๊ด: You are not allowed to view links. Register or Login
GROUP BY t.id_topic
ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '

Find :
โค๊ด: You are not allowed to view links. Register or Login
SUBSTRING(mf.body, 1, 385) AS first_body, ml.smileys_enabled AS last_smileys, mf.smileys_enabled AS first_smileys
Add After :
โค๊ด: You are not allowed to view links. Register or Login
, IFNULL(big.id_attach, 0) AS big_id, big.filename AS big_filename, big.width AS big_width, big.height AS big_height,
IFNULL(thn.id_attach, 0) AS thn_id, thn.filename AS thn_filename, thn.width AS thn_width, thn.height AS thn_height, IFNULL(thn.id_attach, mf.body) AS mainpost, t.id_board

Find :
โค๊ด: You are not allowed to view links. Register or Login
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)

Replace with :
โค๊ด: You are not allowed to view links. Register or Login
LEFT JOIN {db_prefix}attachments AS big ON (big.id_msg = mf.id_msg AND big.attachment_type = 0)
LEFT JOIN {db_prefix}attachments AS thn ON (thn.id_attach = big.id_thumb)
LEFT JOIN {db_prefix}members AS meml ON (meml.id_member = ml.id_member)
LEFT JOIN {db_prefix}members AS memf ON (memf.id_member = mf.id_member)


Find :
โค๊ด: You are not allowed to view links. Register or Login
// Begin 'printing' the message index for current board.
while ($row = $smcFunc['db_fetch_assoc']($result))
{
if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0')
continue;

Add After :
โค๊ด: You are not allowed to view links. Register or Login
// Thumbnail Topic
if ($row['thn_id'] != 0)
{
$image = array(
'id' => $row['thn_id'],
'url' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['thn_id'] . ';image',
'link' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['big_id'] . ';image',
'filename' => $row['thn_filename'],
'width' => $row['thn_width'],
'height' => $row['thn_height'],
'bbcimg' => false,
);

$context['show_thumbnails'] = true;
}
elseif ($row['big_id'] != 0 && $row['big_width'] > 0 && $row['big_height'] > 0)
{
$image = array(
'id' => $row['big_id'],
'url' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['big_id'] . ';image',
'link' => $scripturl . '?action=dlattach;topic=' . $row['id_topic'] . '.0;attach=' . $row['big_id'] . ';image',
'filename' => $row['big_filename'],
'width' => $row['big_width'],
'height' => $row['big_height'],
'bbcimg' => false,
);

$context['show_thumbnails'] = true;
}
else
{
// Scan the main post and get the first image tag
$image = array();

$row['mainpost'] = parse_bbc($row['mainpost'], false,'', array('img'));
preg_match_all('/<img[^>]+>/i',$row['mainpost'], $result2);

$imgTags = array();
foreach($result2 as $img_tag)
{
if (is_array($img_tag))
foreach( $img_tag as $r)
$imgTags[] = $r;
}

$imageTagsToFix = array();
foreach($imgTags as $img_tag)
{
preg_match('/(src)=("[^"]*")/i', $img_tag, $matches);

$matches[2] = str_replace('"',"",$matches[2]);
$matches[2] = str_replace("'","",$matches[2]);

$imageTagsToFix[] = $matches[2];

}

if (!empty($imageTagsToFix))
{
$image = array(
'id' => 1,
'url' => $imageTagsToFix[0],
'bbcimg' => true,
);

$context['show_thumbnails'] = true;
}
}

if (!in_array($row['id_board'],$modSettings['photo_boards']))
{
$context['show_thumbnails'] = false;
}



if (isset($context['topics'][$row['id_topic']]))
{
$context['topics'][$row['id_topic']]['image'][] = $image;
continue;
}

// End Thumbnail Topic Mod

Find :
โค๊ด: You are not allowed to view links. Register or Login
// 'Print' the topic info.
$context['topics'][$row['id_topic']] = array(
'id' => $row['id_topic'],

Add After :
โค๊ด: You are not allowed to view links. Register or Login
'image' => array($image),
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 05 พฤษภาคม 2021, 07:26:38
เอาเฉพาะไฟล์ที่เป็นปัญหาก็แล้วกัน ชักจะยาวไม่เอาเกร็ด ไม่เอาเท้า ไม่เอาเล็บ 5 5 5

./Themes/default/MessageIndex.template.php

จุดที่ 1 ผ่าน
จุดที่ 2 ไม่ผ่าน

Find:
โค๊ด: You are not allowed to view links. Register or Login
<td class="icon2 ', $color_class, '">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>

Replace with :
โค๊ด: You are not allowed to view links. Register or Login
<td class="icon2 ', $color_class, '">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>';
// Thumbnail Topic Mod
if ($context['show_thumbnails'])
{
global $modSettings;
echo '<td class="windowbg2" valign="middle" align="center">';

$imagefound = false;

foreach ($topic['image'] as $image)
{
if ($imagefound == true)
break;

if (isset($image['id']))
{
if (empty($modSettings['topic_thumb_width']) || empty($modSettings['topic_thumb_height']))
{

if ($image['bbcimg'] == false)
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';
else
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" alt="" /></a>';
}
else
{

echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $modSettings['topic_thumb_width'], '" height="', $modSettings['topic_thumb_height'], '" alt="" /></a>';


}

$imagefound = true;
}




}

echo '</td>';
}

// End Thumbnail Topic Mod

echo '
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 05 พฤษภาคม 2021, 07:29:18
  ไฟล์ปัญหาจุดที่ 2

./Sources/ManageSettings.php

Find:
โค๊ด: You are not allowed to view links. Register or Login
// Mod authors, add any settings UNDER this line. Include a comma at the end of the line and don't remove this statement!!
Add After:
โค๊ด: You are not allowed to view links. Register or Login

'',
// Thumbnail Topic Settings
array('int', 'topic_thumb_height'),
array('int', 'topic_thumb_width'),
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 05 พฤษภาคม 2021, 07:31:55
   ถ้าเรามานึกย้อนดู เรียกว่า แก้ปัญหาแบบย้อนกลับ คือติดตั้งเขาไปได้ ทำงานได้แล้ว
ต่อมามีปัญหา จะอันอินสตอลก็ไม่ได้ นั่นย่อมแสดงว่าจุดที่ไม่ได้ แสดงว่าเป็นจุดที่เป็นปัญหา

 ต้องไล่ย้อนไปดูว่า มีมอดตัวใดที่ติดตั้งเพิ่ม หลังจากลงมอดตัวนี้ Thumbnail Topic บ้าง
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 05 พฤษภาคม 2021, 16:25:32
  ลองไล่ดูแล้ว มันก็ไม่มีส่วนไหนที่จะมีปัญหา สงสัยจะเกี่ยวกับ
Server ซะแล้ว
- Mysql เวอร์ชั่นไรนะ

มีคอมมูนิตี้ ด้วยที่นี่...
https://www.simplemachines.org/community/index.php?topic=232539.0
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 06 พฤษภาคม 2021, 07:33:26
ไฟล์  sourcedir/MessageIndex.php

ค้นหา
// Grab the appropriate topic information...
   if (!$pre_query || !empty($topic_ids))
วางไว้หลังค้นหา
   // Thumbnail Topic Mod
   if (isset($modSettings['photo_boards']))
      $modSettings['photo_boards'] = explode(',', $modSettings['photo_boards']);
   else
      $modSettings['photo_boards'] = array($board);
   
   // Used to decide if we thumbnails are shown on this topic listing page
   $context['show_thumbnails'] = false;
   
   // End Thumbnail Topic Mod


ค้นหา
ORDER BY " . ($pre_query ? "FIND_IN_SET(t.ID_TOPIC, '" . implode(',', $topic_ids) . "')" : (!empty($modSettings['enableStickyTopics']) ? 'isSticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . "
วางทับที่ค้นหา
GROUP BY t.ID_TOPIC
         ORDER BY " . ($pre_query ? "FIND_IN_SET(t.ID_TOPIC, '" . implode(',', $topic_ids) . "')" : (!empty($modSettings['enableStickyTopics']) ? 'isSticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . "

ค้นหา
LEFT(ml.body, 384) AS lastBody, LEFT(mf.body, 384) AS firstBody, ml.smileysEnabled AS lastSmileys,
            mf.smileysEnabled AS firstSmileys
วางไว้หลังค้นหา
, IFNULL(big.ID_ATTACH, 0) AS bigId, big.filename AS bigFilename, big.width AS bigWidth, big.height AS bigHeight,
            IFNULL(thn.ID_ATTACH, 0) AS thnId, thn.filename AS thnFilename, thn.width AS thnWidth, thn.height AS thnHeight

ค้นหา
FROM ({$db_prefix}topics AS t, {$db_prefix}messages AS ml, {$db_prefix}messages AS mf)
วางไว้หลังค้นหา
LEFT JOIN {$db_prefix}attachments AS big ON (big.ID_MSG = mf.ID_MSG AND big.attachmentType = 0)
            LEFT JOIN {$db_prefix}attachments AS thn ON (thn.ID_ATTACH = big.ID_THUMB)

ค้นหา
// Begin 'printing' the message index for current board.
      while ($row = mysql_fetch_assoc($result))
      {
         if ($row['ID_POLL'] > 0 && $modSettings['pollMode'] == '0')
            continue;
วางไว้หลังค้นหา
// Thumbnail Topic
         if ($row['thnId'] != 0)
         {
            $image = array(
               'id' => $row['thnId'],
               'url' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['thnId'] . ';image',
               'link' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['bigId'] . ';image',
               'filename' => $row['thnFilename'],
               'width' => $row['thnWidth'],
               'height' => $row['thnHeight']
            );

            $context['show_thumbnails'] = true;
         }
         elseif ($row['bigId'] != 0 && $row['bigWidth'] > 0 && $row['bigHeight'] > 0)
         {
            $image = array(
               'id' => $row['bigId'],
               'url' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['bigId'] . ';image',
               'link' => $scripturl . '?action=dlattach;topic=' . $row['ID_TOPIC'] . '.0;attach=' . $row['bigId'] . ';image',
               'filename' => $row['bigFilename'],
               'width' => $row['bigWidth'],
               'height' => $row['bigHeight']
            );

            $context['show_thumbnails'] = true;
         }
         else
            $image = array();

         if (isset($context['topics'][$row['ID_TOPIC']]))
         {
            $context['topics'][$row['ID_TOPIC']]['image'][] = $image;
            continue;
         }
         
         // End Thumbnail Topic Mod

ค้นหา
// 'Print' the topic info.
         $context['topics'][$row['ID_TOPIC']] = array(
            'id' => $row['ID_TOPIC'],
วางไว้หลังค้นหา
'image' => array($image),




ไฟล์  themedir/MessageIndex.template.php

ค้นหา
<td width="9%" colspan="2" class="catbg3"></td>
วางทับที่ค้นหา
<td width="9%" colspan="', $context['show_thumbnails'] ? 3 : 2, '" class="catbg3"></td>


ค้นหา
echo '
               <tr>
                  <td class="windowbg2" valign="middle" align="center" width="5%">
                     <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
                  </td>
                  <td class="windowbg2" valign="middle" align="center" width="4%">
                     <img src="', $topic['first_post']['icon_url'], '" alt="" />
                  </td>
วางทับที่ค้นหา
echo '
               <tr>
                  <td class="windowbg2" valign="middle" align="center" width="5%">
                     <img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
                  </td>
                  <td class="windowbg2" valign="middle" align="center" width="4%">
                     <img src="', $topic['first_post']['icon_url'], '" alt="" />
                  </td>';
            // Thumbnail Topic Mod
            if ($context['show_thumbnails'])
            {
               echo '<td class="windowbg2" valign="middle" align="center">';

                  $imagefound = false;

                  foreach ($topic['image'] as $image)
                  {
                     if ($imagefound == true)
                        break;

                     if (isset($image['id']))
                     {

                        echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';
                        $imagefound = true;
                     }
                  }

               echo '</td>';
            }
           
            // End Thumbnail Topic Mod
           
echo '

อ้างที่มา... http://www.justusers.net/forum/index.php?topic=3798.0

ตัวอย่างไฟล์แนบนี้   เป็นธีมดีฟอลด์ ติดตั้งธรรมดา แสดงในทันที
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 06 พฤษภาคม 2021, 11:17:01
Could be the theme I believe it only works on the default theme.
- อาจเป็นธีมที่ฉันเชื่อว่าใช้ได้กับธีมเริ่มต้นเท่านั้น

There is no settings in the admin panel.

If you are using a custom theme it will require an edit to a file in the custom theme.
(ไม่มีการตั้งค่าในแผงการดูแลระบบ

หากคุณใช้ธีมที่กำหนดเองจะต้องมีการแก้ไขไฟล์ในธีมที่กำหนดเอง)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 06 พฤษภาคม 2021, 11:47:16
Size is controlled by your attachment and avatars settings
หน้า 22
https://www.simplemachines.org/community/index.php?topic=232539.420
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 07 พฤษภาคม 2021, 11:42:40
 ไปเจอที่นี่...

- http://nevikup.blogspot.com/2011/07/smf-thumbnail.html

- http://nevikup.blogspot.com/2011/07/smf_26.html
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 07 พฤษภาคม 2021, 11:52:56
https://www.smfhacks.com/index.php?topic=2238.0

(http://image.free.in.th/v/2013/id/210507045256.jpg) (http://picture.in.th/id/cca47814592a3f0565171c446fa9a897)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 08 พฤษภาคม 2021, 06:26:42
   ลามไปศึกษาเรื่อง Mysql Server
https://www.srisangworn.go.th/home/nb4nb/mysql.html

    ยาวเลยละคร๊าบ...


  อีกที่...
มีบทความเป็นชุดให้ศึกษากันคลิ๊กที่นี่...
ทำความรู้จัก phpMyAdmin (https://www.mindphp.com/%E0%B8%9A%E0%B8%97%E0%B9%80%E0%B8%A3%E0%B8%B5%E0%B8%A2%E0%B8%99%E0%B8%AD%E0%B8%AD%E0%B8%99%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C/%E0%B8%AA%E0%B8%AD%E0%B8%99-phpmyadmin/6342-version-server-phpmyadmin.html)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 11 พฤษภาคม 2021, 07:21:47
  นำปัญหาไปถามในบอร์ด smf เมื่อ 11 พ.ค. 64 แล้วที่กระทู้นี้
https://www.simplemachines.org/community/index.php?topic=232539.520

It is a very nice mod. I have been using it for two years on smf2.0.13 but suddenly it doesn't show effect. I tried to chase the check but still the same.

   I have put a file from another good working website. But still the same.

   I have two attachments. This will be able to see if there are any errors or if there are other related files.

    Thanks in advance.

(www.auto-nkp.com)

หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 13 พฤษภาคม 2021, 07:24:51
SMF Who download attachment mod
https://custom.simplemachines.org/mods/index.php?mod=4146

(http://image.free.in.th/v/2013/ij/210513122452.jpg) (http://picture.in.th/id/ecc635a5cf7dc90f62ae4ef7b1f225ab)

   ทำการแพร์ใช้กับ smf 2.0.13 ก็ไม่เข้ากัน

อ้างถึง
Sorry, but this modification does not appear to be compatible with the selected version

  แปลได้ประมาณนี้ "ขออภัยดูเหมือนว่าการปรับเปลี่ยนนี้จะเข้ากันไม่ได้กับเวอร์ชันที่เลือก"
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 13 พฤษภาคม 2021, 07:32:32
  ทำการแพร์กับ smf 2.0.18 ได้ผลแฮะ...

Readme
SMF Who Downloaded Attachment mod

License: The MIT License (MIT)
Languages: English, Russian
Mod page: https://custom.simplemachines.org/mods/index.php?mod=4146
Github: https://github.com/realdigger/SMF-Who-Downloaded-Attachment

This modification adds ability to show who downloaded attachment. The list consists of a nickname, date and IP address.

Features:
* Ability to show who downloaded attachment. The list is limited to 1000 members.
* Group permission for this.

File Edits
./Sources/Display.php
Find: [Select]
   $filename = getAttachmentFilename($real_filename, $_REQUEST['attach'], $id_folder, false, $file_hash);
Add Before: [Select]
   call_integration_hook('integrate_attachment_download', array($id_attach, $attachment_type));


./Themes/default/Display.template.php
Find: [Select]
                              (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)<br />';
Replace With: [Select]
                              (', $attachment['size'], ($attachment['is_image'] ? ', ' . $attachment['real_width'] . 'x' . $attachment['real_height'] . ' - ' . $txt['attach_viewed'] : ' - ' . $txt['attach_downloaded']) . ' ' . $attachment['downloads'] . ' ' . $txt['attach_times'] . '.)';
            call_integration_hook('integrate_attachment_download_list', array(&$attachment));

Code
database.php
This file should be able to execute standalone.
hooks.php
This file should be able to execute standalone.
File Operations
Move the included directory "Sources" to "the root directory".
Move the included directory "Themes" to "the root directory".
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 15 พฤษภาคม 2021, 16:57:21
วันนี้ มาลองแกะมอด eXpire Attachments (15 พ.ค. 64)
- ไฟล์ Install.php

โค๊ด: You are not allowed to view links. Register or Login
<?php

/**
 *
 * @package Expire Attachments mod
 * @version 1.0
 * @author Jessica Gonzแlez <suki@missallsunday.com>
 * @copyright Copyright (c) 2013, Jessica Gonzแlez
 * @license http://www.mozilla.org/MPL/MPL-1.1.html
 */

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');

elseif (!defined('SMF'))
exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

global $smcFunc$context;

db_extend('packages');

if (empty($context['uninstalling']))
{
$smcFunc['db_add_column'](
'{db_prefix}attachments',
array(
'name' => 'expire_date',
'type' => 'int',
'size' => 10,
'null' => false
),
array(),
'update',
null
);

// Create the scheduled task
$smcFunc['db_insert'](
'insert',
'{db_prefix}scheduled_tasks',
array(
'id_task' => 'int',
'next_time' => 'int',
'time_offset' => 'int',
'time_regularity' => 'int',
'time_unit' => 'string',
'disabled' => 'int',
'task' => 'string',
),
array(
0001'd'0'attachments_expire_date',
),
array(
'id_task',
)
);
}
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 15 พฤษภาคม 2021, 17:01:44
   โดยเพิ่มคอลัมน์  attachments  ในด้าต้าเบส
name
type
size
none

(http://image.free.in.th/v/2013/io/210515102140.jpg) (http://picture.in.th/id/51a7756ec4b8b5ef6e70c0e8cfc225f3)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 15 พฤษภาคม 2021, 17:03:16
  มีการสร้าง // Create the scheduled task
      $smcFunc['db_insert'](
         'insert',
         '{db_prefix}scheduled_tasks',
         array(
            'id_task' => 'int',
            'next_time' => 'int',
            'time_offset' => 'int',
            'time_regularity' => 'int',
            'time_unit' => 'string',
            'disabled' => 'int',
            'task' => 'string',
         ),
         array(
            0, 0, 0, 1, 'd', 0, 'attachments_expire_date',
         ),
         array(
            'id_task'
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 15 พฤษภาคม 2021, 17:14:34
(http://image.free.in.th/v/2013/in/210515101430.jpg) (http://picture.in.th/id/70bc2877a0e418aae3114c5603595965)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 15 พฤษภาคม 2021, 17:15:29
- hooks.php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
   require_once(dirname(__FILE__) . '/SSI.php');

elseif (!defined('SMF'))
   exit('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

$hooks = array(
   'integrate_pre_include' => '$sourcedir/ExpireAttachments.php',
   'integrate_admin_areas' => 'expire_attachments_admin',
   'integrate_modify_modifications' => 'expire_attachments_modify_modifications',
   'integrate_menu_buttons' => 'expire_attachments_care', // Yes, a whole hook function for a copyright...
);

foreach ($hooks as $hook => $function)
   add_integration_function($hook, $function);
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 17 พฤษภาคม 2021, 15:32:17
  ที่กระทู้นี้ http://pordoo.com/mod/t62/

  มีการอธิบายความในเรื่องการกำหนดความกว้างของภาพ

หลังจากลงmodเสร็จ เราสามารถไปกำหนดขนาดรูปที่โชว์ได้ดังนี้
MessageIndex.template.php
ค้นหา:
โค๊ด: [Select]
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';
แทนที่:
โค๊ด: [Select]
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="120" alt="" /></a>';

ตรงwidth="120" สามารถเปลี่ยนเป็นขนาดที่ต้องการ

Default thumbnail where no attachment exists
find
โค๊ด: [Select]
echo '<a href="', $topic['first_post']['href'], '"><img src="', $image['url'], '" width="', $image['width'], '" height="', $image['height'], '" alt="" /></a>';
                        $imagefound = true;
                     }

add after
โค๊ด: [Select]
// MOD to show default thumnail image
                     else
                     {
                        echo '<img src="http://www.site.com/defaultthumbnail.jpg">';
                        $imagefound = true;
                     }
                     // END MOD to show default thumbnail image
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 17 พฤษภาคม 2021, 18:12:30
- Expired Attachments Mod
https://custom.simplemachines.org/mods/index.php?mod=3843

- Who Downloaded Attachment
https://custom.simplemachines.org/mods/index.php?mod=4146
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 12 มิถุนายน 2021, 17:04:52
เจอตัวปัญหาล่ะ

   ไม่รู้ว่าเกิดจากอะไร ตอนแรกที่ติดตั้งก็ใช้ได้เลย ไม่ได้ทำอะไรมากมาย
แต่พอมีการใช้งานไป มีการติดตั้งมอดโน้น นี้ นั่น มันก็เลยเกิดปัญหาขึ้น
แก้ยังไงก็ไม่จบ 

  สุดท้ายฟลุ๊คตรงไหนล่ะ คือไปสร้างห้องใหม่ ต้องกำหนด ค่าต่างๆ
บังเอิญไปติ๊กตรงนี้เข้า ผลแบบไม่ตั้งใจมันเกิดขึ้นมา 5 5 5

(http://image.free.in.th/v/2013/is/210612095812.jpg)
หัวข้อ: Re: ติดตั้งมอดตัวที่ 6 (5) Thumbnail Topic Mod
เริ่มหัวข้อโดย: Auto Car ที่ 12 มิถุนายน 2021, 17:06:18
  มันไม่ได้เกี่ยวกับ
- ดาต้าเบส ไม่เกี่ยวเลย
- ติดตั้งมอดเพิ่ม อาจจะเกี่ยวบ้าง แต่ไม่โดยตรง