Author Topic: [MOD] Post It! (updated 08.01.2006)  (Read 80906 times)

0 Members and 1 Guest are viewing this topic.

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
[MOD] Post It! (updated 08.01.2006)
« on: November 08, 2005, 01:19:38 PM »
Idea
The 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).

Installation

1)Create new file named postit.php in your 4images root directroy; put this code to the file:
Code: [Select]
<?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">&lt;a href=&quot;<?php echo $_GET["url"]; ?>&quot;&gt;<br />
&lt;img src=&quot;<?php echo $site_url?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>&quot; <?php echo $thumb_width_height?> border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br />

<div class="codeheader">Large version linked to the corresponding page:</div>
<div class="code">&lt;a href=&quot;<?php echo $_GET["url"]; ?>&quot;&gt;<br />
&lt;img src=&quot;<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br /><br />

<div class="codeheader">Large version linked to the corresponding page behind lj-cut:</div>
<div class="code">&lt;lj-cut text=&quot;<?php echo $_GET["name"]; ?> - <?php echo $_GET["width"]; ?> x <?php echo $_GET["height"]; ?> - <?php echo $_GET["size"]; ?>&quot;&gt;<br />&lt;a href=&quot;<?php echo $_GET["url"]; ?>&quot;&gt;<br />
&lt;img src=&quot;<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br /><br />

<div class="codeheader">Thumbnail before lj-cut; large version linked to the corresponding page behind lj-cut:</div>
<div class="code">&lt;img src=&quot;<?php echo $site_url?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>&quot; <?php echo $thumb_width_height?> border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;<br />
&lt;lj-cut text=&quot;<?php echo $_GET["name"]; ?> - <?php echo $_GET["width"]; ?> x <?php echo $_GET["height"]; ?> - <?php echo $_GET["size"]; ?>&quot;&gt;<br />
&lt;a href=&quot;<?php echo $_GET["url"]; ?>&quot;&gt;<br />
&lt;img src=&quot;<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;<br />
&lt;/lj-cut&gt;</div>
</body>
</html>
*Change $site_url= "http://www.yourpage.com" !

2)Open includes/functions.php
Find:
Code: [Select]
  else {
    $user_name = $lang['userlevel_guest'];
    $user_name_link = $user_name;
  }

Add below:
Code: [Select]
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.
Code: [Select]
{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:
Code: [Select]
</head>Add above:
Code: [Select]
<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)
« Last Edit: September 16, 2009, 02:53:23 PM by V@no »
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline Bear

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: [MOD] Post It!
« Reply #1 on: November 08, 2005, 02:24:43 PM »
very useful, i have added it to the admin options for the moment.
wouldnt mind it setup as a members option button to go with the lightbox/ecard/download buttons.

Thank you


Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Post It!
« Reply #2 on: November 10, 2005, 12:45:43 PM »
I followed the steps ..
but the only result I had is a pop up window with an empty page ?

what should be the results ?


Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [MOD] Post It!
« Reply #3 on: November 10, 2005, 12:53:07 PM »
I followed the steps ..
but the only result I had is a pop up window with an empty page ?

what should be the results ?

Download postit.zip -> unzip -> put postit.php in your gallery root directory.
And don't forget to change  $site_url= "http://www.yourpage.com".
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Post It!
« Reply #4 on: November 10, 2005, 01:14:59 PM »
I did .. I've got the same result!

I noticed something in postit.php file :
  • &lt;img src=&quot;<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br /><br />
  • &lt;img src=&quot;<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br /><br />
  • &lt;lj-cut text=&quot;<?php echo $_GET["name"]; ?> - <?php echo $_GET["width"]; ?> x <?php echo $_GET["height"]; ?> - <?php echo $_GET["size"]; ?>&quot;&gt;<br />
    &lt;a href=&quot;<?php echo $_GET["url"]; ?>&quot;&gt;<br />
    &lt;img src=&quot;<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;<br />
    &lt;/lj-cut&gt;</div>
and so do the last 2 of the list

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [MOD] Post It!
« Reply #5 on: November 10, 2005, 01:26:59 PM »
No, that's ok.
Works fine for me.

http://f-gallery.com.ua/img1242.htm
Click "Post It" under the pic and you'll see how it should work.

Wait for the coder of this MOD perhaps he could help you.
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Post It!
« Reply #6 on: November 11, 2005, 01:42:07 PM »
I'm waiting him
thank u

Offline ruudvroon

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • AFTERTHEPARTY.NL
Re: [MOD] Post It!
« Reply #7 on: November 12, 2005, 12:11:24 PM »
I did .. I've got the same result!

I noticed something in postit.php file :
  • &lt;img src=&quot;<?php echo $site_url; ?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>&quot; width=&quot;<?php echo $_GET["width"]; ?>&quot; height=&quot;<?php echo $_GET["height"]; ?>&quot; border=&quot;0&quot; alt=&quot;<?php echo $_GET["name"]; ?>&quot; title=&quot;<?php echo $_GET["name"]; ?>&quot; /&gt;&lt;/a&gt;</div><br /><br />

You need this codes to show the right code on you page without "parsing" it.

Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Post It!
« Reply #8 on: December 08, 2005, 03:34:21 AM »
I've just found the error :

3)Open templates/{your_template}/details.html and put this code where you want "Post It!" link to appear.
Code: [Select]
<a href="javascript:popUp('/postit.php?url='+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}')">Post It!</a>

<a href="javascript:popUp('/postit.php?url='+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}')">Post It!</a>

I removed the /  then every thing worked !




Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Post It!
« Reply #9 on: December 15, 2005, 06:14:17 PM »
if you need a easier version of this mod check the one that i have done for my site ... if u like it i will post the code
Demo:
http://www.surfourspace.net/details.php?image_id=17250

Offline izone

  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [MOD] Post It!
« Reply #10 on: December 15, 2005, 08:13:45 PM »
@ ascanio

Please do that!

Thanks.

Ps. does this support bbcodes too?

Offline fgallery

  • Newbie
  • *
  • Posts: 46
    • View Profile
    • ::: F-Gallery :: Photobank :::
Re: [MOD] Post It!
« Reply #11 on: December 19, 2005, 05:43:35 PM »
if you need a easier version of this mod check the one that i have done for my site ... if u like it i will post the code
Demo:
http://www.surfourspace.net/details.php?image_id=17250

1)Your MOD also gives incorrect links for extrenal images . Can you fix this ?
2)How can I try it ?

Waiting for your reply ;)
http://f-gallery.com.ua
Artistic Photography, Fashion Photography, Cities and Streets of The World, Personal Photos of Livejournal Users.

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: [MOD] Post It!
« Reply #12 on: December 19, 2005, 05:50:06 PM »
try to click again :) its working now
i will post my mod tomorrow

Offline Eagle Eye

  • Full Member
  • ***
  • Posts: 191
    • View Profile
Re: [MOD] Post It!
« Reply #13 on: December 29, 2005, 12:19:14 PM »
Thank you fgallery for this MOD

Here is one micro addition, instead of the text link “post it!” use the attached button file to make it alike other buttons  (ecard, download etc)  :D

I am also attaching a PSD file so that you can modify the text as required….

How to implement it?
1) I have used a absolute link to the image file in the templates/{your_template}/details.html  ; but this is not the best option!!!  :(
2) link the image file with
Code: [Select]
javascript:popUp('/postit.php?url='+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}')
I hope some one can code the modification need to add to function.php so that this becomes more practice to use on multi-lingual sites
If you have just one language on you site, I guess it will be ok without extra modification  :)

Thanks to everyone on this forum 

multipass

  • Guest
Re: [MOD] Post It!
« Reply #14 on: December 29, 2005, 12:29:14 PM »
if you need a easier version of this mod check the one that i have done for my site ... if u like it i will post the code
Demo:
http://www.surfourspace.net/details.php?image_id=17250

YES! i like it :-)

would be great if you can post the code.

greets, alex