Author Topic:  How To Add Automatic Thumbnails To SMF Links!  (Read 4019 times)


0 Members and 1 Guest are viewing this topic.

November 20, 2013, 11:28:51 AM

Offline Brian

  • Administrator
  • Jr. Member
  • *
  • Posts: 49
  • Country: us
  • Karma: 0
    • View Profile
How To Add Automatic Thumbnails To SMF Links!
« on: November 20, 2013, 11:28:51 AM »

(Register to disable this ad!)
"ns"

One important feature missing from SMF Links (by www.SMFHacks.com) is the ability to add a thumbnail to each link. With a few small edits, we can not only add thumbnail images, but it's completely automatic!

Note: This modification applies to SMF Links v3.01, but should be easy to adapt to newer versions.

Step 1: you'll need to sign up with BitPixel.com (a free service which is owned by Google) using a Google account.

Step 2: Once you're logged in, click on 'Get The Code' and you'll see this:



The blacked out area in the photo above is where your unique code number is. Make note of this, you'll need it for the next step.

Step 3: Open \Themes\default\Links2.template.php

Find (Line 343):
Code: [Select]
						<th scope="col" class="smalltext first_th"><a href="' . $scripturl . '?action=links;cat=' . $cat .  ';start=' . $context['start'] . ';sort=title;sorto=' . $newsorto . '">' . $txt['smflinks_ctitle'] . '</a></th>';
Replace with:
Code: [Select]
						<th scope="col" class="smalltext first_th">Thumbnail</th><th scope="col" class="smalltext"><a href="' . $scripturl . '?action=links;cat=' . $cat .  ';start=' . $context['start'] . ';sort=title;sorto=' . $newsorto . '">' . $txt['smflinks_ctitle'] . '</a></th>';

Find (line 401):
Code: [Select]
			$stylecl* = "windowbg";
Replace with:
Code: [Select]
			$stylecl* = "windowbg";
$numofspans++;

Find (Line 407):
Code: [Select]
				echo '<tr cl*="' . $stylecl* . '">';


echo '<td valign="top"><a href="' . $scripturl . '?action=links;sa=visit&id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a></td>';
Replace with:
Code: [Select]
				echo '<tr cl*="' . $stylecl* . '">';
                echo '<td><a href="' . $scripturl . '?action=links;sa=visit&id=' . $row['ID_LINK'] . '" target="blank">';
                echo "<img src='http://img.bitpixels.com/getthumbnail?code=XXXXX&size=200&url=" . $row['url'] . "'/></a></td>";
echo '<td><a href="' . $scripturl . '?action=links;sa=visit&id=' . $row['ID_LINK'] . '" target="blank">' . $row['title'] . '</a></td>';

Important! In the line above, replace the XXXXX after ?code= with your unique BitPixel code.


Note: You can change the size of the thumbnail by replacing the '200' after the '&size=' in the above code.
Available sizes are 100, 120, and 200 (numbers refer to width in pixels).


Step 4: Finally, we need to add the BitPixel attribution and credit to the bottom of the links page:

Find (line 501):
Code: [Select]
			</table>';
}



LinksCopyright();
Replace with:
Code: [Select]
			</table>';
}
            echo '<div style="float:right; font-size:9px;"><a href="http://www.bitpixels.com/">Website thumbnails provided by BitPixels</a></div>';


LinksCopyright();

That's it, you're done!
« Last Edit: November 20, 2013, 12:36:19 PM by Brian »

HostGator
Use SMFHELP25OFF for 25% off!
Tags:
 

HostGator
Use SMFHELP25OFF for 25% off!