IdeaThe idea is that visitors would have possibility to post images from your gallery anywhere in the Internet (forums, guestbook, blogs, livejournal, etc.)
To perform this we need a new button called for e.g "Post It!" under every single image.
Once the button is pressed pop-up window will show-up.
The window will contain 4 different posting codes:1) Large version of an image linked to the corresponding page on your site;
2) Thumbnail linked to the corresponding page with large version on your site;
3) Large version linked to the corresponding page on your gallery behind lj-cut;
4) Thumbnail before lj-cut; large version linked to the corresponding page on your gallery behind lj-cut;
Options 3,4 would be useful for posting in livejournal (
http://livejournal.com).
Installation1)Create new file named
postit.php in your 4images root directroy; put this code to the file:
<?php
$site_url= "http://www.yourpage.com"
?>
<html>
<head>
<title>Post-it</title>
<style type="text/css">
/* A code block - maybe even PHP ;). */
.code
{
color: #000000;
background-color: #FFFFFF;
border: 1px solid #000000;
padding: 3px;
padding-bottom: 20px;
font-family: "courier new", helvetica, "times new roman", serif;
/* font-family: Courier, 'Courier New', sans-serif, helvetica, "times new roman", serif;*/
font-size: x-small;
width: 98%;
max-height: 24em;
margin: 1px auto 1px auto;
/*margin-top: 4px;*/
white-space: nowrap;
overflow: auto;
line-height: 1.3em;
}
.codeheader
{
color: #000000;
text-decoration: none;
font-style: normal;
font-weight: bold;
font-size: small;
}
</style>
</head>
<?php
$cat_id = $_GET["cat_id"];
$thumb = $_GET["thumb"];
$image = "data/thumbnails/$cat_id/$thumb";
$size = getimagesize("$image");
$thumb_height = $size[1];
$thumb_width = $size[0];
$thumb_width_height = (!empty($size[3])) ? " ".$size[3] : "";
$thumb_height = $size[1];
$thumb_width = $size[0];
?>
<body>
<div class="codeheader">Thumbnail linked to the corresponding page:</div>
<div class="code"><a href="<?php echo $_GET["url"]; ?>"><br />
<img src="<?php echo $site_url; ?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>" <?php echo $thumb_width_height; ?> border="0" alt="<?php echo $_GET["name"]; ?>" title="<?php echo $_GET["name"]; ?>" /></a></div><br />
<div class="codeheader">Large version linked to the corresponding page:</div>
<div class="code"><a href="<?php echo $_GET["url"]; ?>"><br />
<img src="<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>" width="<?php echo $_GET["width"]; ?>" height="<?php echo $_GET["height"]; ?>" border="0" alt="<?php echo $_GET["name"]; ?>" title="<?php echo $_GET["name"]; ?>" /></a></div><br /><br />
<div class="codeheader">Large version linked to the corresponding page behind lj-cut:</div>
<div class="code"><lj-cut text="<?php echo $_GET["name"]; ?> - <?php echo $_GET["width"]; ?> x <?php echo $_GET["height"]; ?> - <?php echo $_GET["size"]; ?>"><br /><a href="<?php echo $_GET["url"]; ?>"><br />
<img src="<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>" width="<?php echo $_GET["width"]; ?>" height="<?php echo $_GET["height"]; ?>" border="0" alt="<?php echo $_GET["name"]; ?>" title="<?php echo $_GET["name"]; ?>" /></a></div><br /><br />
<div class="codeheader">Thumbnail before lj-cut; large version linked to the corresponding page behind lj-cut:</div>
<div class="code"><img src="<?php echo $site_url; ?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>" <?php echo $thumb_width_height; ?> border="0" alt="<?php echo $_GET["name"]; ?>" title="<?php echo $_GET["name"]; ?>" /><br />
<lj-cut text="<?php echo $_GET["name"]; ?> - <?php echo $_GET["width"]; ?> x <?php echo $_GET["height"]; ?> - <?php echo $_GET["size"]; ?>"><br />
<a href="<?php echo $_GET["url"]; ?>"><br />
<img src="<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>" width="<?php echo $_GET["width"]; ?>" height="<?php echo $_GET["height"]; ?>" border="0" alt="<?php echo $_GET["name"]; ?>" title="<?php echo $_GET["name"]; ?>" /></a><br />
</lj-cut></div>
</body>
</html>
*Change $site_url= "
http://www.yourpage.com" !
2)Open includes/
functions.phpFind:
else {
$user_name = $lang['userlevel_guest'];
$user_name_link = $user_name;
}
Add below:
if ($detailed_view) {
$site_template->register_vars(array(
"media_thumbnail" => $image_row['image_thumb_file'],
"media_url" => $image_row['image_media_file'],
));
}
3)Unzip 'posit_buttons' archive and upload postit.gif and postit_off.gif to your template images directory (usually '/templates/templatename/images_language')
You can also use hot_link_button pack.
The archives are attached to this post.
4)Open templates/{your_template}/
details.html and put this code where you want "Post It!" button to appear.
{if user_loggedin}<A HREF="javascript:popUp('/postit.php?url='+escape(window.location.href)+'&name={image_name}&cat_id={cat_id}&media_url={media_url}&thumb={media_thumbnail}&height={height}&width={width}&size={image_file_size}')"><img src="{template_lang_image_url}/postit.gif"></a>{endif user_loggedin}{if user_loggedout}<img src="{template_lang_image_url}/postit_off.gif">{endif user_loggedout}
5)Open templates/{your_template}/
header.html Find:
</head>
Add above:
<script language="JavaScript">
<!-- PostIt! Pop-Up Window Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=600,left = 390,top = 212');");
}
// PostIt! Pop-Up Window End -->
</script>
Credits-Original code by
ruudvroon.
-Buttons by
maxpaul.
-Some code parts by
V@no.
Thank you guys!This MOD is still improving and if you have any thoughts about it feel free to comment here (
http://www.4homepages.de/forum/index.php?topic=10284.msg50913#msg50913)