4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: fgallery on November 08, 2005, 01:19:38 PM

Title: [MOD] Post It! (updated 08.01.2006)
Post by: fgallery 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 (http://www.4homepages.de/forum/index.php?topic=10284.msg50913#msg50913))
Title: Re: [MOD] Post It!
Post by: Bear 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

Title: Re: [MOD] Post It!
Post by: Nasser 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 ?

Title: Re: [MOD] Post It!
Post by: fgallery 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".
Title: Re: [MOD] Post It!
Post by: Nasser on November 10, 2005, 01:14:59 PM
I did .. I've got the same result!

I noticed something in postit.php file :
and so do the last 2 of the list
Title: Re: [MOD] Post It!
Post by: fgallery 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.
Title: Re: [MOD] Post It!
Post by: Nasser on November 11, 2005, 01:42:07 PM
I'm waiting him
thank u
Title: Re: [MOD] Post It!
Post by: ruudvroon 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.
Title: Re: [MOD] Post It!
Post by: Nasser 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 !



Title: Re: [MOD] Post It!
Post by: ascanio 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
Title: Re: [MOD] Post It!
Post by: izone on December 15, 2005, 08:13:45 PM
@ ascanio

Please do that!

Thanks.

Ps. does this support bbcodes too?
Title: Re: [MOD] Post It!
Post by: fgallery 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 ;)
Title: Re: [MOD] Post It!
Post by: ascanio on December 19, 2005, 05:50:06 PM
try to click again :) its working now
i will post my mod tomorrow
Title: Re: [MOD] Post It!
Post by: Eagle Eye 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 
Title: Re: [MOD] Post It!
Post by: multipass 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
Title: Re: [MOD] Post It!
Post by: TheOracle on December 29, 2005, 01:29:04 PM
I would not recommend to redirect a page like this :

Quote

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}')


from your HTML templates since your 4images sessions will not be validated.

Please see this topic for more detailed instructions on this :

http://www.4homepages.de/forum/index.php?topic=10897.0
Title: Re: [MOD] Post It!
Post by: fgallery on January 07, 2006, 09:05:57 PM
Thanks for the addition maxpaul!
Can you draw inactive versions of these two buttons ?

PS.I'm trying to make changes to functions.php so the button could be inserted in template with simple {postit_button}.
It will also support multi-lingual sites and it will be inactive for unregistered users
Title: Re: [MOD] Post It!
Post by: Eagle Eye on January 08, 2006, 03:45:45 PM
Thanks fgallery, we will be waiting eagerly for the modification :D

I have updated the buttons and am attaching the files with active and inactive state (along with its PSD files so that you can change the opacity level if required)

Thanks  :)
Title: Re: [MOD] Post It!
Post by: fgallery on January 08, 2006, 03:58:01 PM
Thanks fgallery, we will be waiting eagerly for the modification :D

I have updated the buttons and am attaching the files with active and inactive state (along with its PSD files so that you can change the opacity level if required)

Thanks  :)


Once again thank you for the buttons!
Thanks to V@no the modification is complete.
Topic was updated.
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: BartAfterDark on January 09, 2006, 08:46:29 PM
Could we get a changelog?
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: fgallery on January 09, 2006, 10:00:55 PM
Could we get a changelog?
Of course.

Changelog:
-Added PostIt! button instead of text link;
-Updated code for detail.html;
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: Bear on January 11, 2006, 02:49:03 PM
nice update there  8)
thank you
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: Ch*yeuk on July 25, 2006, 03:08:36 AM
This doesn't work for me.. the thumbnail address is wrong.
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: tamora on July 29, 2006, 02:00:38 PM
Hi,

I followed the instructions closely and everything works okay, except that the image (or thumbnail) isn't shown when I insert the code in a homepage or forum post - all I see is a red x where the image should be. The link to my 4images gallery works fine though.

Any help would be greatly appreciated.

Tamora
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: izone on July 29, 2006, 02:47:31 PM
Hi,

I followed the instructions closely and everything works okay, except that the image (or thumbnail) isn't shown when I insert the code in a homepage or forum post - all I see is a red x where the image should be. The link to my 4images gallery works fine though.

Any help would be greatly appreciated.

Tamora

Could you give us a link that you get from post-it?

Do you have hotlinking on ?
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: BartAfterDark on July 29, 2006, 03:53:20 PM
Hi temora,

I think it has something to do with your htaccss file (hotlink protection)

Hi,

I followed the instructions closely and everything works okay, except that the image (or thumbnail) isn't shown when I insert the code in a homepage or forum post - all I see is a red x where the image should be. The link to my 4images gallery works fine though.

Any help would be greatly appreciated.

Tamora
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: tamora on July 31, 2006, 02:18:23 PM
Hello izone and BarkAfterDark,
thank you very much for your fast reply!

I do have a .htaccess file in the directory /data/database. When I open, it says "deny from all", any ideas on how I have to change that to make the Post It! MOD work? I have looked at some threads in the forums about hotlinking and .htaccess, but am still not sure how to go on...

Again, many thanks for the help.

Tamora
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: izone on July 31, 2006, 03:11:30 PM
I don't think it could be the problem. but if you just remove that line from .htaccess and save it and see if this mod will work again or not.

Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: eZz on August 01, 2006, 03:05:40 PM
is there any way to get BB code links?

and how can i show the feature to all peoples. Right now only logged users can see it, but i want that al lcan see it...
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: comvalley on May 17, 2007, 02:00:06 AM
For BB-Code to post in forums etc. add in postit.php:

Code: [Select]
<div class="codeheader">BB-Code um die volle Bildgr&ouml;sse zuverlinken:</div>
<div class="code">[img]<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>[/img]</div><br /><br />

<div class="codeheader">BB-Code um das Thumbnail zuverlinken:</div>
<div class="code">[url=<?php echo $_GET["url"]; ?>]<br />
[img]<?php echo $site_url?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>[/img][/url]</div>
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: fitterashes on June 30, 2007, 09:36:27 PM
Great mod thank you + comvalley for the bbcode
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: aura on July 09, 2007, 04:26:41 AM
Hi, I know this post isn't active anymore but I just installed this mod and I'm having some issues with it.

I'm getting this display in the pop up


[Warning: getimagesize() [function.getimagesize]: Read error! in /home/eslamoda/public_html/wallpapers/postit.php on line 44


Then the image codes doesn't display propertly, here is an example of the code it shows

<a href="http://www.eslamoda.com/wallpapers/details.php?image_id=1">
<img src="http://www.eslamoda.com/data/thumbnails/1/" border="0" alt="gothic" title="gothic" /></a>


Another
(http://www.eslamoda.com/data/media/1/./data/media)


The URL is here http://www.eslamoda.com/wallpapers/
I would apreciate if anyone could help me


Thanks
Aura
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 10, 2009, 04:03:30 PM
Hi All!

I use multilanguage support in my site and my url look like thise
Code: [Select]
http://youpages.com/img849.htm?l=russian
With parametr ?|=language I received error.
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: V@no on September 10, 2009, 04:06:24 PM
and what error says exactly?
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 12, 2009, 12:00:30 AM
Code: [Select]
Service Temporarily Unavailable

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

   
everything works without ?l=russian parameter
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: V@no on September 12, 2009, 01:42:34 AM
That message doesn't come from 4images itself...can I see it myself?

P.S.
maybe something wrong with your lang/russian/main.php file
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 14, 2009, 07:03:17 PM
Sanx

http://artportal.in.ua/ (http://artportal.in.ua/)

hoster Dreamhost
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: V@no on September 15, 2009, 01:39:13 AM
I don't see any errors in FF3 and IE6
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 15, 2009, 12:05:53 PM
hm..
When a link like "http://artportal.in.ua/img859.htm" - there are no errors, but when a link like "http://artportal.in.ua/img859.htm?l=russian" - an error in all browsers.
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: mawenzi on September 15, 2009, 12:35:42 PM
http://artportal.in.ua/img859.htm?l=russian

... it works perfect for me, without any error, in MSIE 7.0 , MSIE 8.0 , Safari 4.0 , FF 3.5.2 , Iron 1.0.155 ...
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 15, 2009, 06:49:47 PM
I test on other computer in other network sigment in Ukraine and have error. Please help!

it is my address in popup window
with parametr
Code: [Select]
http://artportal.in.ua/postit.php?url=http://artportal.in.ua/img859.htm?l=russian&name=%D0%9C%D0%B0%D0%BA%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%BA%D0%BE%D0%B2%D0%B5%D1%80&cat_id=2&media_url=45991.jpg&thumb=45991.jpg&height=533&width=800&size=473.2%C2%A0KB
without parametr
Code: [Select]
http://artportal.in.ua/postit.php?url=http://artportal.in.ua/img859.htm&name=%D0%9C%D0%B0%D0%BA%D0%BE%D0%B2%D1%8B%D0%B9%20%D0%BA%D0%BE%D0%B2%D0%B5%D1%80&cat_id=2&media_url=45991.jpg&thumb=45991.jpg&height=533&width=800&size=473.2%C2%A0KB
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: V@no on September 16, 2009, 03:00:19 AM
in step 4 replace window.location.href with: escape(window.location.href)
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: daymos on September 16, 2009, 02:34:00 PM
Ho-ho!
Thank you very much!
Title: Re: [MOD] Post It! (updated 08.01.2006)
Post by: Joss on October 26, 2009, 10:55:20 AM
For BB-Code to post in forums etc. add in postit.php:

Code: [Select]
<div class="codeheader">BB-Code um die volle Bildgr&ouml;sse zuverlinken:</div>
<div class="code">[img]<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>[/img]</div><br /><br />

<div class="codeheader">BB-Code um das Thumbnail zuverlinken:</div>
<div class="code">[url=<?php echo $_GET["url"]; ?>]<br />
[img]<?php echo $site_url?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>[/img][/url]</div>

Thanks for the MOD.
There is a mistake for BB-code, you need remove one <BR>, the right code is:

Code: [Select]
<div class="codeheader">BB-Code um die volle Bildgr&ouml;sse zuverlinken:</div>
<div class="code">[img]<?php echo $site_url?>/data/media/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["media_url"]; ?>[/img]</div><br /><br />

<div class="codeheader">BB-Code um das Thumbnail zuverlinken:</div>
<div class="code">[url=<?php echo $_GET["url"]; ?>][img]<?php echo $site_url?>/data/thumbnails/<?php echo $_GET["cat_id"]; ?>/<?php echo $_GET["thumb"]; ?>[/img][/url]</div>

Could MOD's author update the first topic and add the BB code?