4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: yuwen on April 08, 2005, 04:46:24 AM

Title: [MOD] Photo Preview Hack
Post by: yuwen on April 08, 2005, 04:46:24 AM
This mod is now available here (http://www.4homepages.de/forum/index.php?topic=7294.msg150916#msg150916)

I made a patch for user who can preview next and previous photos from current picture at the buttom. This style is the most popular style since the largest album sharing system in Taiwan which owns over 500,000 userer uses that style. 4Images has many user in Taiwan, and many of them has used this patch. Maybe this patch can be integrated into next version(or as a part of option).

There is the demo: http://info.mcu.edu.tw/4images/patch/

Best Regards,
Cheng-Lin Yang

Edited by mawenzi :
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/
patch: http://www.soit.mcu.edu.tw/~aqsss/4images/patch/

Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on April 08, 2005, 11:10:37 AM
The [MOD] Photo Preview is a very much succeeded tool ...  :D
I will test it for my gallery.
Thanks for this MOD  :!:

mawenzi
Title: Re: [MOD] Photo Preview Hack
Post by: Vincent on April 08, 2005, 01:56:48 PM
If you would like to do it like this
http://www.wombat.ch/travel/world/eu/turkey/tuerkey2001/

i could give you the JavaScript code, but this show is all writen - nothing works automaticly!

sincerly
vincent
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on April 08, 2005, 03:12:40 PM
Great job yuwen, the MOD is working perfectly ...  :D

thanks again
mawenzi
Title: Re: [MOD] Photo Preview Hack
Post by: Chris on April 11, 2005, 04:59:36 AM
This used to be an FAQ topic.  It was lost after the attack but now I've restored it.

http://www.4homepages.de/forum/index.php?topic=7350

4images already lets you preview the next and previous images from the details page.  It's HTML that's commented out in the template.
Title: Re: [MOD] Photo Preview Hack
Post by: yuwen on April 11, 2005, 05:48:22 AM
This used to be an FAQ topic.  It was lost after the attack but now I've restored it.

http://www.4homepages.de/forum/index.php?topic=7350

4images already lets you preview the next and previous images from the details page.  It's HTML that's commented out in the template.
Dear Chris,
I thinkl that you've misunderstood my meaning. This patch allows preview next and previous "TWO" photos from the current images. And it placed just under the current image for user to click. The reason why I wrote this mod is that the biggest sharing album system which owns over 500,000 users in Taiwan using this kind of style. Many 4Images Taiwaness users has a lot of feedback from their viewer who complains that they are already used to that kind of style. :) Hopeful, the user in the foreign countries will also like this kind of style. :)
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on April 11, 2005, 01:22:11 PM
hi yuwen,

a little problem with the search funktion and the photo preview ...  :?

on the detail pages of the categories the MOD works without problems. 
but: 
on the detail pages from the search function (e.g. also New Images)
instead of the correct thumbnails the default thumbnail ( jpeg-eye ) are very often shown ...  :?
that does not look so good ...  :!:
is there a solution ...  :?:

mawenzi
Title: Re: [MOD] Photo Preview Hack
Post by: martrix on April 11, 2005, 04:05:20 PM
@ Mawenzi:

it looks like if you did already find the solution  :o

Will you post it here?
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on April 11, 2005, 07:08:26 PM
@ martrix and also @ yuwen

I have still no solution for this problem ...  :? ...  :!:
I only determined it ...  :cry:

mawenzi

Title: Re: [MOD] Photo Preview Hack
Post by: yuwen on April 12, 2005, 03:39:47 AM
hi yuwen,

a little problem with the search funktion and the photo preview ...  :?

on the detail pages of the categories the MOD works without problems. 
but: 
on the detail pages from the search function (e.g. also New Images)
instead of the correct thumbnails the default thumbnail ( jpeg-eye ) are very often shown ...  :?
that does not look so good ...  :!:
is there a solution ...  :?:

mawenzi


Hi mawenzi,
Thanks for your bug report. I'll work on it, and hopefully can fix it as soon as possbile. I'll let you know when I finish you. Good day! :)
Title: Re: [MOD] Photo Preview Hack
Post by: stipko on April 26, 2005, 10:59:50 PM
Thanks guys. I needed both!!

This forum is a good thing.



This used to be an FAQ topic.  It was lost after the attack but now I've restored it.

http://www.4homepages.de/forum/index.php?topic=7350

4images already lets you preview the next and previous images from the details page.  It's HTML that's commented out in the template.
Dear Chris,
I thinkl that you've misunderstood my meaning. This patch allows preview next and previous "TWO" photos from the current images. And it placed just under the current image for user to click. The reason why I wrote this mod is that the biggest sharing album system which owns over 500,000 users in Taiwan using this kind of style. Many 4Images Taiwaness users has a lot of feedback from their viewer who complains that they are already used to that kind of style. :) Hopeful, the user in the foreign countries will also like this kind of style. :)
Title: Re: [MOD] Photo Preview Hack
Post by: Xwall on July 26, 2005, 07:29:25 PM
hi yuwen,

a little problem with the search funktion and the photo preview ...  :?

on the detail pages of the categories the MOD works without problems. 
but: 
on the detail pages from the search function (e.g. also New Images)
instead of the correct thumbnails the default thumbnail ( jpeg-eye ) are very often shown ...  :?
that does not look so good ...  :!:
is there a solution ...  :?:

mawenzi


A possible solution in this post (http://www.4homepages.de/forum/index.php?topic=7071)  8O
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on July 26, 2005, 10:30:16 PM
hi Xwall,

thanks for posting a solution with the default thumbnail ( jpeg-eye ) in the search function ...  :D
I tested your solution ... and no default thumbnail ( jpeg-eye ) is shown in the photo preview
... but ...
now it shows before/next pictures of the category of the picture not of the picture search result ... :?
... mmm ...
that cannot be the completely correct solution .

but thanks again , mawenzi
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on July 27, 2005, 01:15:52 AM
omg...8O just looked in the code and I see a pretty big...mistake and I belive that explains why some people reported double comments or some other wierd thing happens to comments...
the mistake is actualy in the installation instructions, where it sais:
Quote
3. Modify your own details.php, and search the string called: Show Comments
the search string should be Save Comments
Title: Re: [MOD] Photo Preview Hack
Post by: iguanna on October 05, 2006, 12:24:20 AM
where can I download this MOD??
Title: Re: [MOD] Photo Preview Hack
Post by: jackie916 on October 07, 2006, 12:38:44 PM
Anyone who downloaded the patch can re-post the [MOD]?
THX!!!
Title: Re: [MOD] Photo Preview Hack
Post by: jackie916 on October 07, 2006, 02:16:30 PM
No downdload link??
Title: Re: [MOD] Photo Preview Hack
Post by: iguanna on October 09, 2006, 01:22:50 AM
please somebody uplad the download files of this mod

its a dead link
Title: Re: [MOD] Photo Preview Hack
Post by: The Tester on January 02, 2007, 09:19:57 PM
I'm also looking for this MOD. So it would be great if someone could give the instructions here for everyone. Maybe some people that are using it, could show what we need to modify?
From what I see at least mawenzi is using this MOD and he is active on forum...So?
Title: Re: [MOD] Photo Preview Hack
Post by: yuwen on January 04, 2007, 02:04:38 AM
I'm also looking for this MOD. So it would be great if someone could give the instructions here for everyone. Maybe some people that are using it, could show what we need to modify?
From what I see at least mawenzi is using this MOD and he is active on forum...So?
Sorry for the extremely late reply. :( The domain of the website has been changed.
Here is the new link of demo and patch site:
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/
patch: http://www.soit.mcu.edu.tw/~aqsss/4images/patch/

Hope eveything will be fine this time. Again, I feel very sorry for let you guys waiting so long :)

btw, here is my mail: s0170154 _AT_ csie.mcu.edu.tw
Title: Re: [MOD] Photo Preview Hack
Post by: __G__ on March 01, 2007, 05:15:13 AM
hi i installed this mod and it shows 404 error look @ it http://www.mehsus.com/test/img1243.htm
Title: Re: [MOD] Photo Preview Hack
Post by: yuwen on March 01, 2007, 05:44:20 AM
hi i installed this mod and it shows 404 error look @ it http://www.mehsus.com/test/img1243.htm
Would you please give me more specified information about your 4Images?
Ex: Version, OS type... etc.
Title: Re: [MOD] Photo Preview Hack
Post by: __G__ on March 01, 2007, 07:46:06 AM
i am using 4images 1.7.4
Title: Re: [MOD] Photo Preview Hack
Post by: skidpics on September 26, 2007, 12:46:13 PM
I'm also looking for this MOD. So it would be great if someone could give the instructions here for everyone. Maybe some people that are using it, could show what we need to modify?
From what I see at least mawenzi is using this MOD and he is active on forum...So?
Sorry for the extremely late reply. :( The domain of the website has been changed.
Here is the new link of demo and patch site:
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/
patch: http://www.soit.mcu.edu.tw/~aqsss/4images/patch/

Hope eveything will be fine this time. Again, I feel very sorry for let you guys waiting so long :)

btw, here is my mail: s0170154 _AT_ csie.mcu.edu.tw


Would love to see a demo, but I am getting:
Template Error: Couldn't open Template ./templates/world_is/media/php.html at the first site..

Does anyone else have this implemented, so I can take a peek?
Title: Re: [MOD] Photo Preview Hack
Post by: skidpics on September 26, 2007, 12:49:38 PM
I got the patch.zip file, but what do I do with it? No instructions..

Can I post this in the forums, since others are searching for this?
Title: Re: [MOD] Photo Preview Hack
Post by: thunderstrike on September 26, 2007, 12:50:16 PM
I'm also looking for this MOD. So it would be great if someone could give the instructions here for everyone. Maybe some people that are using it, could show what we need to modify?
From what I see at least mawenzi is using this MOD and he is active on forum...So?
Sorry for the extremely late reply. :( The domain of the website has been changed.
Here is the new link of demo and patch site:
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/
patch: http://www.soit.mcu.edu.tw/~aqsss/4images/patch/

Hope eveything will be fine this time. Again, I feel very sorry for let you guys waiting so long :)

btw, here is my mail: s0170154 _AT_ csie.mcu.edu.tw


Would love to see a demo, but I am getting:
Template Error: Couldn't open Template ./templates/world_is/media/php.html at the first site..

Does anyone else have this implemented, so I can take a peek?

Please read this:

http://www.4homepages.de/forum/index.php?topic=17562.0
Title: Re: [MOD] Photo Preview Hack
Post by: thunderstrike on September 26, 2007, 12:50:54 PM
I got the patch.zip file, but what do I do with it? No instructions..

Can I post this in the forums, since others are searching for this?

If so, create new topic in troubleshooting of forum. ;)
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on September 26, 2007, 01:49:01 PM
I got the patch.zip file, but what do I do with it? No instructions..

... I think, who can read is clearly in advantage ...  :wink:
... please read the first post and you will find also this tutorial with all instructions ...

patch: http://www.soit.mcu.edu.tw/~aqsss/4images/patch/
Title: Re: [MOD] Photo Preview Hack
Post by: thunderstrike on September 26, 2007, 01:53:24 PM
In patch,

replace:

Quote
$tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $cat_id, $preview_row[$image_preview[$i]]['image_name'], $mode, 1);

for:

Code: [Select]
$tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $cat_id, format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
Title: Re: [MOD] Photo Preview Hack
Post by: kai on September 26, 2007, 05:58:50 PM
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/

Template Error: Couldn't open Template ./templates/world_is/media/php.html  :(
Title: Re: [MOD] Photo Preview Hack
Post by: thunderstrike on September 26, 2007, 08:19:58 PM
demo: http://www.soit.mcu.edu.tw/~aqsss/4images/

Template Error: Couldn't open Template ./templates/world_is/media/php.html  :(

This might help:

http://www.4homepages.de/forum/index.php?topic=17562.0
Title: Re: [MOD] Photo Preview Hack
Post by: mawenzi on September 26, 2007, 09:07:10 PM
@Kai
... a demo you can also find here (http://klick.kl.funpic.de/details.php?image_id=20) ...
Title: Re: [MOD] Photo Preview Hack
Post by: KurtW on October 15, 2007, 08:28:23 PM
Hi ivan,

 :!: :!:
Quote
3. Modify your own details.php, and search the string called: Show Comments
4. Above the line you searched, please insert a line: include(ROOT_PATH.'preview_photo.php');
:!: :!:
Thanks to rinaldos for this tip


Kurt
Title: Re: [MOD] Photo Preview Hack
Post by: Jan-Lukas on February 12, 2008, 10:02:10 PM
gibt es denn hier nur tote links  :wink:
hat denn einer eine anleitung zur 1.7.6

Hrald
Title: Re: [MOD] Photo Preview Hack
Post by: ccsakuweb on April 29, 2008, 06:19:31 PM
hi! where can i download the mod? the urls are in 404 error
Title: Re: [MOD] Photo Preview Hack
Post by: devil201 on June 12, 2008, 12:53:09 AM
gibt es denn hier nur tote links  :wink:
hat denn einer eine anleitung zur 1.7.6

Hrald

Die Frage ist wohl, gibt dieser User den Code frei!?
Title: Re: [MOD] Photo Preview Hack
Post by: vredin on August 04, 2008, 09:57:25 AM
Does anybody know where patch can be downloaded? all links in this post are 404 :(
Title: Re: [MOD] Photo Preview Hack
Post by: KurtW on September 19, 2008, 06:41:51 PM
Hi,

[MOD] Photo Preview Hack
- all steps in one posting
- new file deleted: i changed it... all modcodes now in details.php
=> show 5 preview of images on top of details
=> the current image is additional marked with different bgcolor

[MOD] Photo Preview Hack
- alle Schritte in einem Posting
- neue Datei entfernt: habe ich geändert, alle Modcodes nun in details.php
=> zeige 5 Vorschaubilder oben in der Details
=> das aktuell angezeigte Bild ist zusätzlich noch mit unterschiedlicher Hintergrundfarbe markiert


Mod work with all 4images versions





Changed files:

Geänderte Dateien:

- details.php
- templates/[your template folder]/details.html
- templates/[your template folder]/style.css


1:
- open details.php
- search:
- öffne details.php
- suche:
Code: [Select]
$image_id_cache = array();

- before add:
- davor einfügen:
Code: [Select]
/*--- Start MOD: Photo Preview Hack, reworked by KW ------------------------- */
// Start Settings for Thumbs

$thumbsize =  0.5; // Thumb Size in %

// End Settings

$result = $site_db->query($sql);
while($row = $site_db->fetch_array($result)){
    $image_preview[] = $row['image_id'];
    $preview_row[$row['image_id']] = $row;
}
$lastPage = count($image_preview);
$t_template = "";
if($lastPage < 6){
    $start = 0;
    $end = $lastPage -1;
} elseif ($act_key == 0 || $act_key == 1){
    $start = 0;
    $end   = 4;
} elseif ($act_key == $lastPage-1 || $act_key == $lastPage -2){
    $start = $lastPage - 5;
    $end = $lastPage - 1;
} else {
    $start = $act_key -2;
    $end   = $act_key +2;
}
for($i=$start; $i<=$end; $i++){
    if ($preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
    $t_template .= "<td class=\"preview_box_colored\">\n";
    } else {
    $t_template .= "<td class=\"preview_box\">\n";
    }
    $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $cat_id, format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
    $oriWidth = substr($tag, strpos($tag, "width")+7, strpos($tag, "\" height")-strlen($tag));
    $oriHeight = substr($tag, strpos($tag, "height")+8, strpos($tag, " alt")-strlen($tag)-1);
    $tag = str_replace('width="'.$oriWidth.'"', 'width="'.$oriWidth*$thumbsize.'"', $tag);
    $tag = str_replace('height="'.$oriHeight.'"', 'height="'.$oriHeight*$thumbsize.'"', $tag);
    $t_template .= $tag."<br />";
    $t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n</td>\n";
}
$site_template->register_vars("preview_box", $t_template);
unset($image_preview);
unset($t_template);
/*--- End MOD: Photo Preview Hack, reworked by KW --------------------------- */





2:
- open templates/[your_template_folder]/details.html
- search:
- öffne templates/[dein_template_verzeichnis]/details.html
- suche:
Code: [Select]
<b class="title">{image_name}</b>{if image_is_new}
- before add:
- or add the code on your favorite place:

- davor einfügen:
- oder an deiner gewünschten Stelle einfügen:
Code: [Select]
                 {if preview_box}
                  <table border="0" cellspacing="5" cellpadding="3" align="center">
                   <tr>
                    {preview_box}
                   </tr>
                  </table><br/>
                  {endif preview_box}





3:
- open templates/[your_template_folder]/style.css
- search:
- öffne templates/[dein_template_verzeichnis]/style.css
- suche:
Code: [Select]
?>
- before add:
- davor einfügen:
Code: [Select]
/*--- Start Mod: Photo Preview Hack, reworked by KW ---------------------------*/
.preview_box {
  border: 1px dashed #004C75;
  vertical-align: top;
  text-align: center;
}

.preview_box_colored {
  border: 1px solid #004C75;
  background: #F1F1F1;
  vertical-align: top;
  text-align: center;
}
/*--- Start Mod: Photo Preview Hack, reworked by KW ---------------------------*/


KurtW
Title: Re: [MOD] Photo Preview Hack
Post by: Jan-Lukas on September 19, 2008, 07:36:25 PM
Danke Anke (ähmm, Kurt  :wink:)

Klappt wie immer erste Sahne

LG. Harald

Ps. wenn man die Bilderanzahl erhöht z.B.

    $start = $lastPage - 9;
    $end = $lastPage - 1;
} else {
    $start = $act_key -4;
    $end   = $act_key +4;

dann kommt auf einigen Seiten ein Thumb (Bild nicht gefunden ) ohne Bild ID details.php?image_id=

was muss denn alles geändert werden, um die Anzahl zu erhöhen
Title: Re: [MOD] Photo Preview Hack
Post by: rinaldos on September 20, 2008, 11:08:23 AM
Ich habe nun mal versucht die Anzahl der Bilder zu erhöhen. Geschafft habe ich es aufgrund meines Design's das 7 Bilder angezeigt werden.
Code: [Select]
if($lastPage <= 6){
    $start = 0;
    $end = $lastPage -1;
} elseif ($act_key == 0 || $act_key == 1 || $act_key == 2){
    $start = 0;
    $end   = 6;
} elseif ($act_key == $lastPage-1 || $act_key == $lastPage -2|| $act_key == $lastPage -3 || $act_key == $lastPage -4){
    $start = $lastPage - 7;
    $end = $lastPage - 1;
} else {
    $start = $act_key -3;
    $end   = $act_key +3;
}

Damit auch Bilder bei der Suche aus anderen Kategorien angezeigt werden, und nicht nur das JPG media File, habe ich folgendes geändert.
$cat_id ausgetauscht gegen $preview_row[$image_preview[$i]]['cat_id']
finde
Code: [Select]
    $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $cat_id, format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
ersetze
Code: [Select]
    $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);

Wenn man die Anzahl der Bilder erhöht, muss man auch für seine Galerie die Anzahl derer die Abgefragt werden ausschliessen. Das passiert mit den $act_key Anweisungen.Da habe ich bei mir eben noch ein paar eingefügt. Vielleicht gibt es da noch eine einfacherer Lösung. Also wirklich try and ERROR  :?:

Gruß
Ingo

Title: Re: [MOD] Photo Preview Hack
Post by: Kurman on September 29, 2008, 01:17:37 AM
Nice MOD, thanks!
Quote
dann kommt auf einigen Seiten ein Thumb (Bild nicht gefunden ) ohne Bild ID details.php?image_id=
This problem I'have too. I couldn't fix it (maybe I didn't properly understand you)  :|

Does anyone know how this mode affects on speed of gallery? Is here anybody, who tested that MOD on gallery with many pictures?
Title: Re: [MOD] Photo Preview Hack
Post by: rinaldos on September 29, 2008, 07:47:39 AM
Like this?
http://rinaldos.homeip.net/img8673.htm

Quote
dann kommt auf einigen Seiten ein Thumb (Bild nicht gefunden ) ohne Bild ID details.php?image_id=
This problem I'have too. I couldn't fix it (maybe I didn't properly understand you)  :|

Does anyone know how this mode affects on speed of gallery? Is here anybody, who tested that MOD on gallery with many pictures?

The Problem with "Picture not found" is solved with this line:
Code: [Select]
    $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
This little Modifikatio worked for me.

Gruß
Ingo
Title: Re: [MOD] Photo Preview Hack
Post by: Kurman on September 30, 2008, 12:01:16 AM
Yes, rinaldos, it works properly while viewing 7 thumbnails, but when they are 9, problem remains. (I used 9 thumbnails viewer)

So, I'have decided to use 7-thumbnails instean of 9, like you in your gallery. (Of course I want 9 and more thumbnails to be viewed, but if there still no solution for that, we prefer to stay in mod, working without bugs)  8)

thanks!
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on February 24, 2009, 08:14:21 AM
Hi!

EDIT: hat sich erledigt, manchmal sieht man den wald vor lauter bäume nicht.

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: __G__ on February 24, 2009, 09:25:45 AM
Hi!

könnte mir da wer weiterhelfen ich möchte den seitlichen abstand zwischen den bildern größer haben.
hier mein code:

/*--------------------------------------------- Start MOD: Photo Preview Hack ----------------------------------------- */
$result = $site_db->query($sql);

while($row = $site_db->fetch_array($result)){
    $image_preview[] = $row['image_id'];
    $preview_row[$row['image_id']] = $row;
}
$lastPage = count($image_preview);
$t_template = "<table height=\"0\"width=\"0\"  border=\"0\" cellspacing=\"5\" cellpadding=\"3\" align=\"center\"><tr>\n";
if($lastPage < 6){
    $start = 0;
    $end = $lastPage -1;
} elseif ($act_key == 0 || $act_key == 1){
    $start = 0;
    $end   = 4;
} elseif ($act_key == $lastPage-1 || $act_key == $lastPage -2){
    $start = $lastPage - 5;
    $end = $lastPage - 1;
} else {
    $start = $act_key -2;
    $end   = $act_key +2;
}
$sizeTimes = 0.5;
for($i=$start; $i<=$end; $i++){
    if ($preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
    $t_template .= "<td style=\"border: 1px dashed #004C75; text-align:center; padding: .1cm \">\n";
    } else {
    $t_template .= "<td style=text-align:center; padding: .1cm\">\n";
    }
    $tag = get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
    $oriWidth = substr($tag, strpos($tag, "width")+7, strpos($tag, "\" height")-strlen($tag));
    $oriHeight = substr($tag, strpos($tag, "height")+8, strpos($tag, " alt")-strlen($tag)-1);
    $tag = str_replace('width="'.$oriWidth.'"', 'width="'.$oriWidth*$sizeTimes.'"', $tag);
    $tag = str_replace('height="'.$oriHeight.'"', 'height="'.$oriHeight*$sizeTimes.'"', $tag);
    $t_template .= $tag."<br>\n";
    $t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n";
}
$t_template .= "</td></table>\n";
$site_template->register_vars("preview_box", $t_template);
unset($image_preview);
/*--- End MOD: Photo Preview Hack  ------------------------------------------ */
 

mfg Andi


Thanks i like this one :D bro can we also add previous image next image on both side :D by any chance ?
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on February 24, 2009, 03:18:50 PM
...
Thanks i like this one :D bro can we also add previous image next image on both side :D by any chance ?
in details.html:
Code: [Select]
{if prev_image_name}{lang_prev_image}<br />
                              <b><a href="{prev_image_url}">{prev_image_name}</a></b>
<br /><br /><a href="{prev_image_url}"><img src="{prev_thumb_file}" border="1"></a>
{endif prev_image_name}&nbsp;</td>
                            <td align="right" class="row2">
&nbsp;{if next_image_name}{lang_next_image}<br />
                              <b><a href="{next_image_url}">{next_image_name}</a></b>
<br /><br /><a href="{next_image_url}"><img src="{next_thumb_file}" border="1"></a>
{endif next_image_name}</td>

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 10, 2009, 07:58:29 AM
I really want to use this file... but I after following the directions I recieve a not found icon/ here is my details.php:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: details.php                                          *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'details';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');
/*
  MOD AJAX COMMENTS
  BEGIN INSERT
*/
include(ROOT_PATH."ajaxcomments.php");
/*
  MOD AJAX COMMENTS
  END INSERT
*/
if (!$image_id) {
    
redirect($url);
}

$additional_sql "";
if (!empty(
$additional_image_fields)) {
  foreach (
$additional_image_fields as $key => $val) {
    
$additional_sql .= ", i.".$key;
  }
}

$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email")."
        FROM ("
.IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
        LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = i.user_id)
        WHERE i.image_id = 
$image_id AND i.image_active = 1 AND c.cat_id = i.cat_id";
$image_row $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 0;

if (!
check_permission("auth_viewcat"$cat_id) || !check_permission("auth_viewimage"$cat_id) || !$image_row) {
  
redirect($url);
}

$random_cat_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" get_random_image($cat_id);
$site_template->register_vars("random_cat_image"$random_cat_image);
unset(
$random_cat_image);

//-----------------------------------------------------
//--- Show Image --------------------------------------
//-----------------------------------------------------
$image_allow_comments = (check_permission("auth_readcomment"$cat_id)) ? $image_row['image_allow_comments'] : 0;
$image_name format_text($image_row['image_name'], 2);
show_image($image_row$mode01);

$in_mode 0;

$sql "";
if (
$mode == "lightbox") {
  if (!empty(
$user_info['lightbox_image_ids'])) {
    
$image_id_sql str_replace(" "", "trim($user_info['lightbox_image_ids']));
    
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM "
.IMAGES_TABLE."
            WHERE image_active = 1 AND image_id IN (
$image_id_sql) AND (cat_id NOT IN (".get_auth_cat_sql("auth_viewimage""NOTIN").", ".get_auth_cat_sql("auth_viewcat""NOTIN")."))
            ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
    
$in_mode 1;
  }
}
elseif (
$mode == "search") {
  if (!isset(
$session_info['searchid']) || empty($session_info['searchid'])) {
    
$session_info['search_id'] = $site_sess->get_session_var("search_id");
  }

  if (!empty(
$session_info['search_id'])) {
    
$search_id unserialize($session_info['search_id']);
  }

  
$sql_where_query "";

  if (!empty(
$search_id['image_ids'])) {
    
$sql_where_query .= "AND image_id IN (".$search_id['image_ids'].") ";
  }

  if (!empty(
$search_id['user_ids'])) {
    
$sql_where_query .= "AND user_id IN (".$search_id['user_ids'].") ";
  }

  if (!empty(
$search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
    
$new_cutoff time() - 60 60 24 $config['new_cutoff'];
    
$sql_where_query .= "AND image_date >= $new_cutoff ";
  }

  if (!empty(
$search_id['search_cat']) && $search_id['search_cat'] != 0) {
    
$cat_id_sql 0;
    if (
check_permission("auth_viewcat"$search_id['search_cat'])) {
      
$sub_cat_ids get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
      
$cat_id_sql .= ", ".$search_id['search_cat'];
      if (!empty(
$sub_cat_ids[$search_id['search_cat']])) {
        foreach (
$sub_cat_ids[$search_id['search_cat']] as $val) {
          if (
check_permission("auth_viewcat"$val)) {
            
$cat_id_sql .= ", ".$val;
          }
        }
      }
    }
    
$cat_id_sql $cat_id_sql !== "AND cat_id IN ($cat_id_sql)" "";
  }
  else {
    
$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");
    
$cat_id_sql $cat_id_sql !== "AND cat_id NOT IN (".$cat_id_sql.")" "";
  }

  if (!empty(
$sql_where_query)) {
    
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
            FROM "
.IMAGES_TABLE."
            WHERE image_active = 1
            
$sql_where_query
            
$cat_id_sql
            ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
    
$in_mode 1;
  }
}
if (!
$in_mode || empty($sql)) {
  
$sql "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
          FROM "
.IMAGES_TABLE."
          WHERE image_active = 1 AND cat_id = 
$cat_id
          ORDER BY "
.$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort'];
}
$result $site_db->query($sql);

$image_id_cache = array();
$next_prev_cache = array();
$break 0;
$prev_id 0;
while(
$row $site_db->fetch_array($result)) {
  
$image_id_cache[] = $row['image_id'];
  
$next_prev_cache[$row['image_id']] = $row;
  if (
$break) {
    break;
  }
  if (
$prev_id == $image_id) {
    
$break 1;
  }
  
$prev_id $row['image_id'];
}
$site_db->free_result();

if (!
function_exists("array_search")) {
  function 
array_search($needle$haystack) {
    
$match false;
    foreach (
$haystack as $key => $value) {
      if (
$value == $needle) {
        
$match $key;
      }
    }
    return 
$match;
  }
}

$act_key array_search($image_id$image_id_cache);
$next_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
$prev_image_id = (isset($image_id_cache[$act_key 1])) ? $image_id_cache[$act_key 1] : 0;
unset(
$image_id_cache);

// Get next and previous image
if (!empty($next_prev_cache[$next_image_id])) {
  
$next_image_name format_text($next_prev_cache[$next_image_id]['image_name'], 2);
  
$next_image_url $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$next_image_id.((!empty($mode)) ? "&amp;mode=".$mode ""));
  if (!
get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media"$next_prev_cache[$next_image_id]['cat_id'], 00)) {
    
$next_image_file ICON_PATH."/404.gif";
  }
  else {
    
$next_image_file get_file_path($next_prev_cache[$next_image_id]['image_media_file'], "media"$next_prev_cache[$next_image_id]['cat_id'], 01);
  }
  if (!
get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$next_image_id]['cat_id'], 00)) {
    
$next_thumb_file ICON_PATH."/".get_file_extension($next_prev_cache[$next_image_id]['image_media_file']).".gif";
  }
  else {
    
$next_thumb_file get_file_path($next_prev_cache[$next_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$next_image_id]['cat_id'], 01);
  }
}
else {
  
$next_image_name REPLACE_EMPTY;
  
$next_image_url REPLACE_EMPTY;
  
$next_image_file REPLACE_EMPTY;
  
$next_thumb_file REPLACE_EMPTY;
}

if (!empty(
$next_prev_cache[$prev_image_id])) {
  
$prev_image_name format_text($next_prev_cache[$prev_image_id]['image_name'], 2);
  
$prev_image_url $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&amp;mode=".$mode ""));
  if (!
get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media"$next_prev_cache[$prev_image_id]['cat_id'], 00)) {
    
$prev_image_file ICON_PATH."/404.gif";
  }
  else {
    
$prev_image_file get_file_path($next_prev_cache[$prev_image_id]['image_media_file'], "media"$next_prev_cache[$prev_image_id]['cat_id'], 01);
  }
  if (!
get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$prev_image_id]['cat_id'], 00)) {
    
$prev_thumb_file ICON_PATH."/".get_file_extension($next_prev_cache[$prev_image_id]['image_media_file']).".gif";
  }
  else {
    
$prev_thumb_file get_file_path($next_prev_cache[$prev_image_id]['image_thumb_file'], "thumb"$next_prev_cache[$prev_image_id]['cat_id'], 01);
  }
}
else {
  
$prev_image_name REPLACE_EMPTY;
  
$prev_image_url REPLACE_EMPTY;
  
$prev_image_file REPLACE_EMPTY;
  
$prev_thumb_file REPLACE_EMPTY;
}

$site_template->register_vars(array(
  
"next_image_id" => $next_image_id,
  
"next_image_name" => $next_image_name,
  
"next_image_url" => $next_image_url,
  
"next_image_file" => $next_image_file,
  
"next_thumb_file" => $next_thumb_file,
  
"prev_image_id" => $prev_image_id,
  
"prev_image_name" => $prev_image_name,
  
"prev_image_url" => $prev_image_url,
  
"prev_image_file" => $prev_image_file,
  
"prev_thumb_file" => $prev_thumb_file
));
unset(
$next_prev_cache);
//-----------------------------------------------------
//--- Show Count Lightbox -----------------------------
//-----------------------------------------------------

$sql "SELECT COUNT(*) AS counter
        FROM "
.LIGHTBOXES_TABLE."
        WHERE lightbox_image_ids REGEXP '([^0-9]|^)"
.$image_row['image_id']."([^0-9]|$)'";
        
$lightbox_count $site_db->query_firstrow($sql);

$site_template->register_vars(array(
  
"lang_image_lightbox_count" => $lang['image_lightbox_count'],
  
"lightbox_count" => (isset($lightbox_count['counter']) && $lightbox_count['counter']) ? $lightbox_count['counter'] : 0
));

unset(
$lightbox_count);
/*--------------------------------------------- Start MOD: Photo Preview Hack ----------------------------------------- */
$result $site_db->query($sql);

while(
$row $site_db->fetch_array($result)){
    
$image_preview[] = $row['image_id'];
    
$preview_row[$row['image_id']] = $row;
}
$lastPage count($image_preview);
$t_template "<table height=\"0\"width=\"600\"  border=\"0\" cellspacing=\"5\" cellpadding=\"3\" align=\"center\"><tr>\n";
if(
$lastPage 6){
    
$start 0;
    
$end $lastPage -1;
} elseif (
$act_key == || $act_key == 1){
    
$start 0;
    
$end   4;
} elseif (
$act_key == $lastPage-|| $act_key == $lastPage -2){
    
$start $lastPage 5;
    
$end $lastPage 1;
} else {
    
$start $act_key -2;
    
$end   $act_key +2;
}
$sizeTimes 0.5;
for(
$i=$start$i<=$end$i++){
    if (
$preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
    
$t_template .= "<td style=\"border: 1px dashed #004C75; text-align:center; padding: .1cm \">\n";
    } else {
    
$t_template .= "<td style=text-align:center; padding: .1cm\">\n";
    }
    
$tag get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode1);
    
$oriWidth substr($tagstrpos($tag"width")+7strpos($tag"\" height")-strlen($tag));
    
$oriHeight substr($tagstrpos($tag"height")+8strpos($tag" alt")-strlen($tag)-1);
    
$tag str_replace('width="'.$oriWidth.'"''width="'.$oriWidth*$sizeTimes.'"'$tag);
    
$tag str_replace('height="'.$oriHeight.'"''height="'.$oriHeight*$sizeTimes.'"'$tag);
    
$t_template .= $tag."<br>\n";
    
$t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n";
}
$t_template .= "</td></table>\n";
$site_template->register_vars("preview_box"$t_template);
unset(
$image_preview);
/*--- End MOD: Photo Preview Hack  ------------------------------------------ */
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$error 0;
if (
$action == "postcomment" && isset($HTTP_POST_VARS[URL_ID])) {
  
$id intval($HTTP_POST_VARS[URL_ID]);
  
$sql "SELECT cat_id, image_allow_comments
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$id";
  
$row $site_db->query_firstrow($sql);

  if (
$row['image_allow_comments'] == || !check_permission("auth_postcomment"$row['cat_id']) || !$row) {
    
$msg $lang['comments_deactivated'];
  }
  else {
    
$user_name un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    
$comment_headline un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    
$comment_text un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));

    
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

    
// Flood Check
    
$sql "SELECT comment_ip, comment_date
            FROM "
.COMMENTS_TABLE."
            WHERE image_id = 
$id
            ORDER BY comment_date DESC
            LIMIT 1"
;
    
$spam_row $site_db->query_firstrow($sql);
    
$spamtime $spam_row['comment_date'] + 180;

    if (
$session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['spamming'];
      
$error 1;
    }

    
$user_name_field get_user_table_field("""user_name");
    if (!empty(
$user_name_field)) {
      if (
$site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("""user_id")." <> '".$user_info['user_id']."'")) {
        
$msg .= (($msg != "") ? "<br />" "").$lang['username_exists'];
        
$error 1;
      }
    }
    if (
$user_name == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required'];
      
$error 1;
    }
    if (
$comment_headline == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['headline_required'];
      
$error 1;
    }
    if (
$comment_text == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['comment_required'];
      
$error 1;
    }

    if (
$captcha_enable_comments && !captcha_validate($captcha)) {
      
$msg .= (($msg != "") ? "<br />" "").$lang['captcha_required'];
      
$error 1;
    }

    if (!
$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
    }
  }
  unset(
$row);
  unset(
$spam_row);
}

//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($image_allow_comments == 1) {
  
$site_template->register_vars(array(
      
"has_rss"   => true,
      
"rss_title" => "RSS Feed: ".$image_name." (".str_replace(':'''$lang['comments']).")",
      
"rss_url"   => $script_url."/rss.php?action=comments&amp;".URL_IMAGE_ID."=".$image_id
  
));

  
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email").get_user_table_field(", u.""user_showemail").get_user_table_field(", u.""user_invisible").get_user_table_field(", u.""user_joindate").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_comments").get_user_table_field(", u.""user_homepage").get_user_table_field(", u.""user_icq").", u.userpic


,c.comment_rating,c.comment_votes,c.comment_rating_users
          FROM "
.COMMENTS_TABLE." c
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = c.user_id)
          WHERE c.image_id = 
$image_id
          


ORDER BY c.comment_date "
.(COMMENTS_ORDER "DESC" "ASC")."";
  
$result $site_db->query($sql);

  
$comment_row = array();
  while (
$row $site_db->fetch_array($result)) {
    
$comment_row[] = $row;
  }
  
$site_db->free_result($result);
  
$num_comments sizeof($comment_row);

  if (!
$num_comments) {
    
$comments "<tr><td class=\"commentrow1\" colspan=\"2\">".$lang['no_comments']."</td></tr>";
  }
  else {
    
$comments "";
    
$bgcounter 0;
    for (
$i 0$i $num_comments$i++) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;

      
$comment_user_email "";
      
$comment_user_email_save "";
      
$comment_user_mailform_link "";
      
$comment_user_email_button "";
      
$comment_user_homepage_button "";
      
$comment_user_icq_button "";
      
$comment_user_profile_button "";
      
$comment_user_status_img REPLACE_EMPTY;
      
$comment_user_name format_text($comment_row[$i]['comment_user_name'], 2);
      
$comment_user_info $lang['userlevel_guest'];

      
$comment_user_id $comment_row[$i]['user_id'];
      
      if (isset(
$comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        
$comment_user_name format_text($comment_row[$i][$user_table_fields['user_name']], 2);

        
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/"$comment_user_id$url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$comment_user_id);
        
$comment_user_profile_button "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";

        
$comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";

        
$comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
        if (!empty(
$comment_user_homepage)) {
          
$comment_user_homepage_button "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
        }

        
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
        if (!empty(
$comment_user_icq)) {
          
$comment_user_icq_button "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
        }

        if (!empty(
$comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
          
$comment_user_email format_text($comment_row[$i][$user_table_fields['user_email']]);
          
$comment_user_email_save format_text(str_replace("@"" at "$comment_row[$i][$user_table_fields['user_email']]));
          if (!empty(
$url_mailform)) {
            
$comment_user_mailform_link $site_sess->url(preg_replace("/{user_id}/"$comment_user_id$url_mailform));
          }
          else {
            
$comment_user_mailform_link $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
          }
          
$comment_user_email_button "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
        }

        if (!isset(
$comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
          
$comment_user_info $lang['userlevel_user'];
        }
        elseif (
$comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
          
$comment_user_info $lang['userlevel_admin'];
        }

        
$comment_user_info .= "<br />";
        
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
        
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
      }

      
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";

      
$admin_links "";
      if (
$user_info['user_level'] == ADMIN) {
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }
      elseif (
$is_image_owner) {
        
$admin_links .= ($config['user_edit_comments'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= ($config['user_delete_comments'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
      }

      
//--- Kommentar-Autor COUNTRY FLAGS ---
    
if (!class_exists("GeoIP"))
    {
      include(
ROOT_PATH."includes/geoip.inc");
    }
    
$gi geoip_open(ROOT_PATH."includes/GeoIP.dat",GEOIP_STANDARD);
    
$countries = array();
    
$cid geoip_country_code_by_addr($gi$comment_row[$i]['comment_ip']);
    if (empty(
$cid)) $cid "lan";
    
$countries[$cid] = isset($countries[$cid]) ? $countries[$cid]+1;
    
$comment_user_flag "<img src=\"".ROOT_PATH."flags/".strtolower($cid).".gif"."\" alt=\"".(($cid != "lan") ? $gi->GEOIP_COUNTRY_NAMES[$gi->GEOIP_COUNTRY_CODE_TO_NUMBER[$cid]] : "Unknown or LAN")."\" border=0>";
//--- Kommentar-Autor COUNTRY FLAGS ---

      
$site_template->register_vars(array(
        
"comment_id" => $comment_row[$i]['comment_id'],
        
"comment_user_flag" => $comment_user_flag,
        
"comment_user_id" => $comment_user_id,
        
"comment_user_status_img" => $comment_user_status_img,
        
"comment_user_name" => $comment_user_name,
        
"comment_user_info" => $comment_user_info,
        
"comment_user_profile_button" => $comment_user_profile_button,
        
"comment_user_email" => $comment_user_email,
        
"comment_user_email_save" => $comment_user_email_save,
        
"comment_user_mailform_link" => $comment_user_mailform_link,
        
"comment_user_email_button" => $comment_user_email_button,
        
"comment_user_homepage_button" => $comment_user_homepage_button,
        
"comment_user_icq_button" => $comment_user_icq_button,
        
"comment_user_ip" => $comment_user_ip,
        
"comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
        
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0$config['wordwrap_comments'], 00),
        
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
        
"row_bg_number" => $row_bg_number,
        
"admin_links" => $admin_links
      
));
      
/*
  MOD AJAX COMMENTS
  BEGIN INSERT
*/
      
if (COMMENT_RATING_ANABLE)
      {
        
$comment_row[$i]['cat_id'] = $cat_id;
        
$comment_row[$i]['image_allow_comments'] = $image_allow_comments;
        
comment_rating_template($comment_row[$i]);
      }
/*
  MOD AJAX COMMENTS
  END INSERT
*/
      
$comments .= $site_template->parse_template("comment_bit");
    } 
// end while
  
//end else
  /*
  MOD AJAX COMMENTS
  START REPLACE
*/
  
$site_template->register_vars(array(
    
"comments" => $comments,
    
"comments_num" => $num_comments,
    
"commentbg" => (isset($row_bg_number)) ? $row_bg_number 0,
    
"page" => $page,
    
"perpage" => $commentperpage,
  ));

/*
  MOD AJAX COMMENTS
  END REPLACE
*/
  
unset($comments);

  
//-----------------------------------------------------
  //--- BBCode & Form -----------------------------------
  //-----------------------------------------------------
  
$allow_posting check_permission("auth_postcomment"$cat_id);
  
$bbcode "";
  if (
$config['bb_comments'] == && $allow_posting) {
    
$site_template->register_vars(array(
      
"lang_bbcode" => $lang['bbcode'],
      
"lang_tag_prompt" => $lang['tag_prompt'],
      
"lang_link_text_prompt" => $lang['link_text_prompt'],
      
"lang_link_url_prompt" => $lang['link_url_prompt'],
      
"lang_link_email_prompt" => $lang['link_email_prompt'],
      
"lang_list_type_prompt" => $lang['list_type_prompt'],
      
"lang_list_item_prompt" => $lang['list_item_prompt']
    ));
    
$bbcode $site_template->parse_template("bbcode");
  }

  if (!
$allow_posting) {
    
$comment_form "";
  }
  else {
    
$user_name = (isset($HTTP_POST_VARS['user_name']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['user_name'])), 2) : (($user_info['user_level'] != GUEST) ? format_text($user_info['user_name'], 2) : "");
    
$comment_headline = (isset($HTTP_POST_VARS['comment_headline']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_headline'])), 2) : "";
    
$comment_text = (isset($HTTP_POST_VARS['comment_text']) && $error) ? format_text(trim(stripslashes($HTTP_POST_VARS['comment_text'])), 2) : "";

    
$site_template->register_vars(array(
      
"bbcode" => $bbcode,
      
"user_name" => $user_name,
      
"comment_headline" => $comment_headline,
      
"comment_text" => $comment_text,
      
"lang_post_comment" => $lang['post_comment'],
      
"lang_name" => $lang['name'],
      
"lang_headline" => $lang['headline'],
      
"lang_comment" => $lang['comment'],
      
"lang_captcha" => $lang['captcha'],
      
"lang_captcha_desc" => $lang['captcha_desc'],
      
"captcha_comments" => (bool)$captcha_enable_comments
    
));
    
$comment_form $site_template->parse_template("comment_form");
  }
  
$site_template->register_vars("comment_form"$comment_form);
  unset(
$comment_form);
// end if allow_comments

// Admin Links
$admin_links "";
if (
$user_info['user_level'] == ADMIN) {
  
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=editimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
  
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("images.php?action=removeimage&amp;image_id=".$image_id))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif (
$is_image_owner) {
  
$admin_links .= ($config['user_edit_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['edit']."</a>&nbsp;";
  
$admin_links .= ($config['user_delete_image'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removeimage&amp;".URL_IMAGE_ID."=".$image_id)."\">".$lang['delete']."</a>";
}
$site_template->register_vars("admin_links"$admin_links);

// Update Hits
if ($user_info['user_level'] != ADMIN) {
  
$sql "UPDATE ".IMAGES_TABLE."
          SET image_hits = image_hits + 1
          WHERE image_id = 
$image_id";
  
$site_db->query($sql);
}

//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];

if (
$mode == "lightbox" && $in_mode) {
  
$page_url "";
 if (
preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
    if (!empty(
$regs[1]) && $regs[1] != 1) {
      
$page_url "?".URL_PAGE."=".$regs[1];
    }
  }
  
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."lightbox.php".$page_url)."\" class=\"clickstream\">".$lang['lightbox']."</a>".$config['category_separator'];
}
elseif (
$mode == "search" && $in_mode) {
  
$page_url "";
  if (
preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
    if (!empty(
$regs[1]) && $regs[1] != 1) {
      
$page_url "&amp;".URL_PAGE."=".$regs[1];
    }
  }
  
$clickstream .= "<a href=\"".$site_sess->url(ROOT_PATH."search.php?show_result=1".$page_url)."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'];
}
else {
  
$clickstream .= get_category_path($cat_id1).$config['category_separator'];
}
$clickstream .= $image_name."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
  
"lang_category" => $lang['category'],
  
"lang_added_by" => $lang['added_by'],
  
"lang_description" => $lang['description'],
  
"lang_keywords" => $lang['keywords'],
  
"lang_date" => $lang['date'],
  
"lang_hits" => $lang['hits'],
  
"lang_downloads" => $lang['downloads'],
  
"lang_rating" => $lang['rating'],
  
"lang_votes" => $lang['votes'],
  
"lang_author" => $lang['author'],
  
"lang_comment" => $lang['comment'],
  
"lang_prev_image" => $lang['prev_image'],
  
"lang_next_image" => $lang['next_image'],
  
"lang_file_size" => $lang['file_size']
));

$site_template->print_template($site_template->parse_template($main_template));
include(
ROOT_PATH.'includes/page_footer.php');
?>
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on March 10, 2009, 08:06:21 AM
In your particular case you'll need insert that code below
unset($next_prev_cache);
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 10, 2009, 08:07:41 AM
I also understand you must modify the content of the ajaxcomments.php with the same details as the details.php file and I have with this:

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: ajaxcomments.php                                     *
 *     File Version: 1.0.1                                                *
 *      Description: module that handles AJAX comment related requests    *
 *           Author: V@no                                                 *
 *              Web: http://4images.vano.org                              *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *************************************************************************/

define("COMMENT_RATING_ENABLE"1); //enable ratings for comments?
define("COMMENT_RATING_GUEST"0); //allow guests to vote?
define("COMMENT_RATING_OWN"0); //allow rate own comments?
define("COMMENT_RATING_HIDE", -3); //comment with rating below this number will be hidden by default (visitors still will be able read them by clicking at + icon)
define("COMMENTS_PAGES"1); //show pages for comments? must install http://www.4homepages.de/forum/index.php?topic=5830.0
define("COMMENTS_ORDER"0); //sort comments 0 = ASC or 1 = DESC

if (!defined('ROOT_PATH')) //check if this file included or direct request
{
  if (!isset(
$HTTP_GET_VARS)) {
    
$HTTP_GET_VARS    = &$_GET;
    
$HTTP_POST_VARS   = &$_POST;
    
$HTTP_COOKIE_VARS = &$_COOKIE;
    
$HTTP_POST_FILES  = &$_FILES;
    
$HTTP_SERVER_VARS = &$_SERVER;
    
$HTTP_ENV_VARS    = &$_ENV;
  }
  
$HTTP_GET_VARS JSUnicodeUnEscape($HTTP_GET_VARS);
  
$HTTP_POST_VARS JSUnicodeUnEscape($HTTP_POST_VARS);
  
$HTTP_COOKIE_VARS JSUnicodeUnEscape($HTTP_COOKIE_VARS);
  
$HTTP_POST_FILES JSUnicodeUnEscape($HTTP_POST_FILES);

  
define('GET_CACHES'1);
  
define('ROOT_PATH''./');
  
$main_template '';
  include(
ROOT_PATH.'global.php');
  require(
ROOT_PATH.'includes/sessions.php');
  
$user_access get_permission();
  
$included false;
}
else
{
  
$included true;
}
/*
comment_rating_check()
returns:
0 = "not rated yet",
1 = "invalid comment id",
2 = "guests are not allowed to vote",
3 = "permission denied",
4 = "can't vote on own comments",
5 = "already voted",
6 = "Comment rating disabled",
*/
function comment_rating_check($id$row false)
{
  if (!
COMMENT_RATING_ENABLE)
    return 
6;
  global 
$user_info$site_sess$site_db;
  if (!
$id)
    return 
1;
  if (
$user_info['user_level'] == GUEST && !COMMENT_RATING_GUEST)
    return 
2;
  if (!isset(
$user_info['comments_rated']))
  {
    
$comments_rated $site_sess->get_session_var("comments_rated");
    if (empty(
$comments_rated))
      
$comments_rated $site_sess->read_cookie_data("comments_rated");
    
$user_info['comments_rated'] = explode(","$comments_rated);
  }
  if (
$user_info['user_level'] != GUEST && empty($row))
  {
    
$sql "SELECT c.comment_id, c.image_id, c.comment_rating, c.comment_votes, c.comment_rating_users, c.comment_ip, c.user_id, i.cat_id, i.image_allow_comments
            FROM "
.COMMENTS_TABLE." c
            LEFT JOIN "
.IMAGES_TABLE." i ON (i.image_id = c.image_id)
            WHERE c.comment_id = 
$id";
    if (!(
$row $site_db->query_firstrow($sql)))
      return 
1;
  }
  if (!
$row['image_allow_comments'] || !check_permission("auth_readcomment"$row['cat_id']) || !check_permission("auth_viewimage"$row['cat_id']) || !check_permission("auth_viewcat"$row['cat_id']))
    return 
3;

  if (!
COMMENT_RATING_OWN
        
&& (($user_info['user_level'] == GUEST && $row['user_id'] == GUEST && @$row['comment_ip'] == $site_sess->session_info['session_ip'])
              || (
$user_info['user_level'] != GUEST && $row['user_id'] == $user_info['user_id'])))
  {
      return 
4;
  }
  if (
$user_info['user_level'] == GUEST)
  {
    return (
comment_rating_search($id$user_info['comments_rated']) === false) ? 5;
  }
  
  return (
comment_rating_search($user_info['user_id'], explode(","$row['comment_rating_users'])) === false) ? 5;
}


function 
comment_rating_search($id$array)
{
  
$id = (int)$id;
  foreach (
$array as $key)
  {
    
$key explode(" "$key);
    if ((int)
$key[0] == $id)
      return (isset(
$key[1])) ? (int)$key[1] : true;
  }
  
  return 
false;
}


function 
comment_rating_update($id$rating$row false)
{
  global 
$user_info;
  if (!
$id)
    return 
false;
  global 
$user_info$site_sess$site_db;
  if (
$row === false)
  {
    
$sql "SELECT comment_id, comment_ip, user_id, comment_rating, comment_votes, comment_rating_users
            FROM "
.COMMENTS_TABLE."
            WHERE comment_id = 
$id
            LIMIT 1"
;
    if (!(
$row $site_db->query_firstrow($sql)))
      return 
false;
  }
  
$row['comment_rating'] = (int)$row['comment_rating'] + ((int)$rating : -1);
  
$rated explode(","$row['comment_rating_users']);
  
  if (
$user_info['user_level'] != GUEST && comment_rating_search($user_info['user_id'], $rated) === false)
  {
    
$rated[] = $user_info['user_id']." ".$rating;
  }
  
$rated trim(implode(","$rated), ",");

  
$sql "UPDATE ".COMMENTS_TABLE."
          SET comment_rating = "
.$row['comment_rating'].", comment_votes = comment_votes + 1, comment_rating_users = '$rated'
          WHERE comment_id = 
$id";

  if (!(
$result $site_db->query($sql)))
    return 
false;

  if (!isset(
$user_info['comments_rated']))
  {
    
$comment_rated $site_sess->get_session_var("comments_rated");
    if (!
$comment_rated)
      
$comment_rated $site_sess->read_cookie_data("comments_rated");
    
$user_info['comments_rated'] = explode(","$comment_rated);
  }
  if (
comment_rating_search($id$user_info['comments_rated']) === false)
  {
    
$user_info['comments_rated'][] = $id." ".$rating;
    
$comment_rated trim(implode(","$user_info['comments_rated']), ",");
    
$site_sess->set_session_var("comments_rated"$comment_rated);
    
$site_sess->set_cookie_data("comments_rated"$comment_rated);
  }
  return array(
$row['comment_rating'], $row['comment_votes'] + 1);
}


function 
comment_rating_links($id$row false)
{
  global 
$user_info$site_sess$site_db;
  
$type "_off";
  
$link false;
  if (!(
$rating_check comment_rating_check($id$row)))
  {
    
$link true;
    
$type "";
  }
    
  
$img_good '<img src="'.TEMPLATE_PATH.'/images/good'.$type.'.png" border="0" id="cimgg'.$id.'" align="top" />'//thumb up
  
$img_bad '<img src="'.TEMPLATE_PATH.'/images/bad'.$type.'.png" border="0" id="cimgb'.$id.'" align="top" />'//thumb down
  
  
if ($link)
  {
    
$c_url ROOT_PATH."ajaxcomments.php?action=ratingset&".URL_ID."=".$id."&mode=";
    
$img_good '<a id="cimglg'.$id.'" href="'.$site_sess->url($c_url."1""&").'" onClick="return aCVote(this,'.$id.',1);">'.$img_good."</a>";
    
$img_bad '<a id="cimglb'.$id.'" href="'.$site_sess->url($c_url."0""&").'" onClick="return aCVote(this,'.$id.',0);">'.$img_bad."</a>";
  }
  return array(
$img_good$img_bad$rating_check);
}


function 
comment_rating_template($row)
{
  global 
$site_sess$site_template$lang$row_bg_number;
  
$row['comment_rating'] = (int)$row['comment_rating'];
  
$links comment_rating_links($row['comment_id'], $row);
  
$site_template->register_vars(array(
    
"comment_rating" => $row['comment_rating'],
    
"comment_rating_str" => (($row['comment_rating'] > 0) ? "+" "").$row['comment_rating'],
    
"comment_votes" => $row['comment_votes'],
    
"comment_rating_link_good" => $links[0],
    
"comment_rating_link_bad" => $links[1],
    
"comment_class" => ($row['comment_rating'] > "1" : ($row['comment_rating'] < "2" "0")),
    
"comment_hide" => ($row['comment_rating'] <= COMMENT_RATING_HIDE) ? 0,
    
"comment_vote_tooltip" => $lang['comment_rating_check'][$links[2]],
  ));
}

function 
JSUnicodeUnEscape($str)
{
  if (
is_array($str))
  {
    foreach (
$str as $key => $val)
    {
      
$str[$key] = JSUnicodeUnEscape($val);
    }
  }
  return 
preg_replace("/%u([0-9a-fA-F]{4,4})/ei""'&#38;#'.hexdec('\\1').';'"$str);
}

if (!
function_exists("get_self"))
{
  function 
get_self()
  {
    
$list get_included_files();
    return 
$list[0];
  }
}


if (!
function_exists("get_self_full"))
{
  function 
get_self_full($remove = array())
  {
    global 
$HTTP_GET_VARS;
    
$q $HTTP_GET_VARS;
    
$query = array();
    foreach(
$q as $key => $val)
    {
      if (
in_array($key$remove))
        continue;
      
$query[] = $key "=" $val;
    }
    return 
ROOT_PATH.basename(get_self()).(!empty($query) ? "?".trim(implode("&"$query), "&") : "");
  }
}

$site_template->register_vars(array(
  
"lang_author" => $lang['author'],
  
"lang_comment" => $lang['comment'],
  
"commentratinghide" => COMMENT_RATING_HIDE,
  
"comment_rating_enable" => COMMENT_RATING_ENABLE,
  
"ajaxcommentsurl" => $site_sess->url(ROOT_PATH."ajaxcomments.php""&"),
  
"lang_comment_rating" => $lang['comment_rating'],
  
"lang_votes" => $lang['votes'],
  
"url_id" => URL_ID,
));
if (
$included)
{
  
$site_sess->set_session_var("back_url"get_self_full());
  if (
$text $site_sess->get_session_var("comment_msg"))
  {
    
$site_sess->drop_session_var("comment_msg");
    
$msg .= (($msg) ? "<br />" "").$text;
  }
  return;
}


//execute the rest of the code only if started directly

$return = array();
//-----------------------------------------------------
//--- Get Comment Rating ------------------------------
//-----------------------------------------------------
if ($action == "ratingget" && $id)
{
  
$return += array(
    
"error"   => 1,
    
"rating"  => "",
    
"votes"   => "",
    
"msg"     => "",
  );
  
$sql "SELECT c.image_id, c.comment_rating, c.comment_votes, c.comment_rating_users, c.comment_ip, c.user_id, i.cat_id, i.image_allow_comments
          FROM "
.COMMENTS_TABLE." c
          LEFT JOIN "
.IMAGES_TABLE." i ON (i.image_id = c.image_id)
          WHERE c.comment_id = 
$id";
  if (
$row $site_db->query_firstrow($sql))
  {
    if (
$row['image_allow_comments'] && check_permission("auth_readcomment"$row['cat_id']) && check_permission("auth_viewimage"$row['cat_id']) && check_permission("auth_viewcat"$row['cat_id']))
    {
      
$return['error'] = 0;
      
$return['rating'] = $row['comment_rating'];
      
$return['votes'] = $row['comment_votes'];
    }
  }
  
}

//-----------------------------------------------------
//--- Save Vote for Comment ---------------------------
//-----------------------------------------------------
if ($action == "ratingset")
{
  
$return += array(
    
"error"   => 1,
    
"rating"  => "",
    
"votes"   => "",
    
"status"  => 0,
    
"msg"     => "",
  );
  if (
$id)
  {
    
$sql "SELECT c.comment_id, c.image_id, c.comment_rating, c.comment_votes, c.comment_rating_users, c.comment_ip, c.user_id, i.cat_id, i.image_allow_comments
            FROM "
.COMMENTS_TABLE." c
            LEFT JOIN "
.IMAGES_TABLE." i ON (i.image_id = c.image_id)
            WHERE c.comment_id = 
$id";
    if (
$row $site_db->query_firstrow($sql))
    {
      if (!(
$is_rated comment_rating_check($id$row)) && (($rating comment_rating_update($id$mode$row)) !== false))
      {
        
$return['error'] = 0;
        
$return['rating'] = $rating[0];
        
$return['votes'] = $rating[1];
        
$return['status'] = 1;
        
$return['msg'] = $lang['comment_rating_success'];
      }
      else
      {
        
$return['status'] = (in_array($is_rated, array(12345))) ? 0;
        
$return['msg'] = $lang['comment_rating_check'][$is_rated];
      }
    }
    else
    {
      
$return['status'] = 1;
      
$return['msg'] = $lang['voting_com_error'];
    }
  }
}
$result $site_db->query($sql);

while(
$row $site_db->fetch_array($result)){
    
$image_preview[] = $row['image_id'];
    
$preview_row[$row['image_id']] = $row;
}
$lastPage count($image_preview);
$t_template "<table height=\"0\"width=\"600\"  border=\"0\" cellspacing=\"5\" cellpadding=\"3\" align=\"center\"><tr>\n";
if(
$lastPage 6){
    
$start 0;
    
$end $lastPage -1;
} elseif (
$act_key == || $act_key == 1){
    
$start 0;
    
$end   4;
} elseif (
$act_key == $lastPage-|| $act_key == $lastPage -2){
    
$start $lastPage 5;
    
$end $lastPage 1;
} else {
    
$start $act_key -2;
    
$end   $act_key +2;
}
$sizeTimes 0.5;
for(
$i=$start$i<=$end$i++){
    if (
$preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
    
$t_template .= "<td style=\"border: 1px dashed #004C75; text-align:center; padding: .1cm \">\n";
    } else {
    
$t_template .= "<td style=text-align:center; padding: .1cm\">\n";
    }
    
$tag get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode1);
    
$oriWidth substr($tagstrpos($tag"width")+7strpos($tag"\" height")-strlen($tag));
    
$oriHeight substr($tagstrpos($tag"height")+8strpos($tag" alt")-strlen($tag)-1);
    
$tag str_replace('width="'.$oriWidth.'"''width="'.$oriWidth*$sizeTimes.'"'$tag);
    
$tag str_replace('height="'.$oriHeight.'"''height="'.$oriHeight*$sizeTimes.'"'$tag);
    
$t_template .= $tag."<br>\n";
    
$t_template .= "<font class=\"smalltext\">".$preview_row[$image_preview[$i]]['image_name']."</font>\n";
}
$t_template .= "</td></table>\n";
$site_template->register_vars("preview_box"$t_template);
unset(
$image_preview);
/*--- End MOD: Photo Preview Hack  ------------------------------------------ */
//-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------
$newcomment 0;
if (
$action == "postcomment" && $id)
{
  
$return += array(
    
"error" => 1,
    
"msg" => "",
    
"clear" => 0,
    
"paging" => "null",
  );
  
$commentid 0;
$error 0;
if (isset(
$HTTP_POST_VARS[URL_ID])) {
//begin almost original code from details.php

  
$id intval($HTTP_POST_VARS[URL_ID]);
  
$sql "SELECT cat_id, image_allow_comments
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$id";
  
$row $site_db->query_firstrow($sql);

  if (
$row['image_allow_comments'] == || !check_permission("auth_postcomment"$row['cat_id']) || !$row) {
    
$msg $lang['comments_deactivated'];
  }
  else {
    
$user_name un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
    
$comment_headline un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
    
$comment_text un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
    
$captcha = (isset($HTTP_POST_VARS['captcha'])) ? un_htmlspecialchars(trim($HTTP_POST_VARS['captcha'])) : "";

    
// Flood Check
    
$sql "SELECT comment_ip, comment_date
            FROM "
.COMMENTS_TABLE."
            WHERE image_id = 
$id
            ORDER BY comment_date DESC
            LIMIT 1"
;
    
$spam_row $site_db->query_firstrow($sql);
    
$spamtime $spam_row['comment_date'] + 180;

    if (
$session_info['session_ip'] == $spam_row['comment_ip'] && time() <= $spamtime && $user_info['user_level'] != ADMIN)  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['spamming'];
      
$error 1;
    }

    
$user_name_field get_user_table_field("""user_name");
    if (!empty(
$user_name_field)) {
      if (
$site_db->not_empty("SELECT $user_name_field FROM ".USERS_TABLE." WHERE $user_name_field = '".strtolower($user_name)."' AND ".get_user_table_field("""user_id")." <> '".$user_info['user_id']."'")) {
        
$msg .= (($msg != "") ? "<br />" "").$lang['username_exists'];
        
$error 1;
      }
    }
    if (
$user_name == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['name_required'];
      
$error 1;
    }
    if (
$comment_headline == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['headline_required'];
      
$error 1;
    }
    if (
$comment_text == "")  {
      
$msg .= (($msg != "") ? "<br />" "").$lang['comment_required'];
      
$error 1;
    }

    if (
$captcha_enable_comments && !captcha_validate($captcha)) {
      
$msg .= (($msg != "") ? "<br />" "").$lang['captcha_required'];
      
$error 1;
    }

    if (!
$error)  {
      
$sql "INSERT INTO ".COMMENTS_TABLE."
              (image_id, user_id, user_name, comment_headline, comment_text, comment_ip, comment_date)
              VALUES
              (
$id, ".$user_info['user_id'].", '$user_name', '$comment_headline', '$comment_text', '".$session_info['session_ip']."', ".time().")";
      
$site_db->query($sql);
      
$commentid $site_db->get_insert_id();
      
update_comment_count($id$user_info['user_id']);
      
$msg $lang['comment_success'];
    }
  }
  unset(
$row);
  unset(
$spam_row);
}
//end original code from details.php

  
else
  {
    
$msg "error";
  }
//  if (($image_row['image_comments'] + (isset($commentid) ? 1 : 0)) > 24) $cat_cache[$cat_id]['auth_postcomment'] = AUTH_ADMIN;
  
if ($commentid)
  {
    
$action "commentget";
    
$newcomment 1;
    if (isset(
$HTTP_POST_VARS['one']) || isset($HTTP_GET_VARS['one']))
    {
      
$image_id 0;
      
$id $commentid;
    }
    else
    {
      
$image_id $id;
      
$id $commentid;
    }
  }
  
$return['error'] = $error;
  
$return['msg'] = $msg;
  
$return['clear'] = !$error;
}


//-----------------------------------------------------
//--- Show Comments -----------------------------------
//-----------------------------------------------------
if ($action == "commentget" && ($id || $image_id))
{
  
$return += array(
    
"comment" => "",
    
"paging" => "",
    
"pagingstats" => "",
    
"page" => 1,
    
"perpage" => 5,
    
"type" => 0,
  );
  
$comments_all = ($image_id); //show all comments

  
include(ROOT_PATH."includes/page_header.php");
  
$site_template->register_vars(array(
    
"lang_comment_rating" => $lang['comment_rating'],
    
"lang_added_by" => $lang['added_by'],
    
"lang_date" => $lang['date'],
    
"lang_rating" => $lang['rating'],
  ));


  
$offset null;
  if (
COMMENTS_PAGES && file_exists(TEMPLATE_PATH."/commentsperpage_dropdown_form.html"))
  {
    if (isset(
$HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage']))
    {
      
$commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
      if (
$commentsetperpage)
      {
        
$site_sess->set_session_var("commentperpage"$commentsetperpage);
        
$session_info['commentperpage'] = $commentsetperpage;
      }
    }
    
    if (isset(
$session_info['commentperpage']))
    {
      
$commentperpage $session_info['commentperpage'];
    }
    else
    {
      
$commentperpage 5;
    }

    
$sql "SELECT COUNT(image_id) AS comments
            FROM "
.COMMENTS_TABLE."
            WHERE image_id = 
$image_id";
    
$result $site_db->query_firstrow($sql);
    
$site_db->free_result();
    
$num_comments $result['comments'];
    if (
$newcomment && !COMMENTS_ORDER)
    {
      
$page ceil($num_comments $commentperpage);
    }
    
$num_rows_all = (isset($num_comments)) ? $num_comments 0;
    
$link_arg $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=$image_id");
    include(
ROOT_PATH.'includes/paging.php');
    
$getpaging = new Paging($page$commentperpage$num_rows_all$link_arg$lang['comment_stats'], "comments");
    
$offset $getpaging->get_offset();
    
$site_template->register_vars(array(
      
"paging" => $return['paging'] = str_replace(array("<a "'onSubmit="'), array('<a onclick="return CommentsPage(this);" ''onSubmit="return CommentsPerPage(this);'), $getpaging->get_paging()),
      
"paging_stats" => $return['pagingstats'] = ($num_comments) ? $getpaging->get_paging_stats() : "",
    ));
    
$additional_sql "";
    if (!empty(
$additional_user_fields))
    {
      
$table_fields $site_db->get_table_fields(USERS_TABLE);
      foreach (
$additional_user_fields as $key => $val)
      {
        if (isset(
$table_fields[$key]))
        {
          
$additional_sql .= ", u.$key";
        }
      }
    }
  }
  else
  {
    
$site_template->register_vars(array(
      
"paging" => "",
      
"paging_stats" => "",
    ));
  }
  if (
$comments_all)
  {
    
$where "WHERE c.image_id = $image_id
              ORDER BY c.comment_date "
.(COMMENTS_ORDER "DESC" "ASC");
    if (
$offset !== null)
    {
      
$where .= " LIMIT $offset$commentperpage";
    }
  }
  else
  {
    
$where "WHERE c.comment_id = $id";
  }

//the code in this section is almost identical to the code in details.php

  
$sql "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_email").get_user_table_field(", u.""user_showemail").get_user_table_field(", u.""user_invisible").get_user_table_field(", u.""user_joindate").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_comments").get_user_table_field(", u.""user_homepage").get_user_table_field(", u.""user_icq").", u.userpic, i.image_allow_comments, i.cat_id, i.user_id AS image_user_id".(COMMENT_RATING_ENABLE ",c.comment_rating,c.comment_votes,c.comment_rating_users" "").$additional_sql."
          FROM "
.COMMENTS_TABLE." c
          LEFT JOIN "
.USERS_TABLE." u ON (".get_user_table_field("u.""user_id")." = c.user_id)
          LEFT JOIN "
.IMAGES_TABLE." i ON (i.image_id = c.image_id)
          "
.$where;
  
$result $site_db->query($sql);
  
$comment_row = array();
  while (
$row $site_db->fetch_array($result)) {
    
$comment_row[] = $row;
  }
  
$site_db->free_result($result);
  
$num_comments count($comment_row);
  
$cat_id = (isset($comment_row[0]['cat_id'])) ? $comment_row[0]['cat_id'] : 0;
  
$is_image_owner = ($comment_row[0]['image_user_id'] > USER_AWAITING && $user_info['user_id'] == $comment_row[0]['image_user_id']) ? 0;
  
$image_allow_comments = (check_permission("auth_readcomment"$cat_id) && check_permission("auth_viewimage"$cat_id) && check_permission("auth_viewcat"$cat_id)) ? $comment_row[0]['image_allow_comments'] : 0;
  if (
$image_allow_comments)
  {
    
$comments "";
    
$bgcounter = ($comments_all) ? : ((isset($HTTP_POST_VARS['commentbg'])) ? intval($HTTP_POST_VARS['commentbg']) : ((isset($HTTP_GET_VARS['commentbg'])) ? $HTTP_GET_VARS['commentbg'] : 0));
    for (
$i 0$i $num_comments$i++) {
      
$row_bg_number = ($bgcounter++ % == 0) ? 2;

      
$comment_user_email "";
      
$comment_user_email_save "";
      
$comment_user_mailform_link "";
      
$comment_user_email_button "";
      
$comment_user_homepage_button "";
      
$comment_user_icq_button "";
      
$comment_user_profile_button "";
      
$comment_user_status_img REPLACE_EMPTY;
      
$comment_user_name format_text($comment_row[$i]['comment_user_name'], 2);
      
$comment_user_info $lang['userlevel_guest'];

      
$comment_user_id $comment_row[$i]['user_id'];

      if (isset(
$comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
        
$comment_user_name format_text($comment_row[$i][$user_table_fields['user_name']], 2);

        
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/"$comment_user_id$url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$comment_user_id);
        
$comment_user_profile_button "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";

        
$comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";

        
$comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
        if (!empty(
$comment_user_homepage)) {
          
$comment_user_homepage_button "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
        }

        
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? format_text($comment_row[$i][$user_table_fields['user_icq']]) : "";
        if (!empty(
$comment_user_icq)) {
          
$comment_user_icq_button "<a href=\"http://www.icq.com/people/about_me.php?uin=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
        }

        if (!empty(
$comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
          
$comment_user_email format_text($comment_row[$i][$user_table_fields['user_email']]);
          
$comment_user_email_save format_text(str_replace("@"" at "$comment_row[$i][$user_table_fields['user_email']]));
          if (!empty(
$url_mailform)) {
            
$comment_user_mailform_link $site_sess->url(preg_replace("/{user_id}/"$comment_user_id$url_mailform));
          }
          else {
            
$comment_user_mailform_link $site_sess->url(ROOT_PATH."member.php?action=mailform&amp;".URL_USER_ID."=".$comment_user_id);
          }
          
$comment_user_email_button "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
        }

        if (!isset(
$comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
          
$comment_user_info $lang['userlevel_user'];
        }
        elseif (
$comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
          
$comment_user_info $lang['userlevel_admin'];
        }

        
$comment_user_info .= "<br />";
        
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
        
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
      }

      
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";

      
$admin_links "";
      if (
$user_info['user_level'] == ADMIN) {
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
      }
      elseif (
$is_image_owner) {
        
$admin_links .= ($config['user_edit_comments'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        
$admin_links .= ($config['user_delete_comments'] != 1) ? "" "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
      }

      
$site_template->register_vars(array(
        
"comment_id" => $comment_row[$i]['comment_id'],
        
"comment_user_id" => $comment_user_id,
        
"comment_user_status_img" => $comment_user_status_img,
        
"comment_user_name" => $comment_user_name,
        
"comment_user_info" => $comment_user_info,
        
"comment_user_profile_button" => $comment_user_profile_button,
        
"comment_user_email" => $comment_user_email,
        
"comment_user_email_save" => $comment_user_email_save,
        
"comment_user_mailform_link" => $comment_user_mailform_link,
        
"comment_user_email_button" => $comment_user_email_button,
        
"comment_user_homepage_button" => $comment_user_homepage_button,
        
"comment_user_icq_button" => $comment_user_icq_button,
        
"comment_user_ip" => $comment_user_ip,
          
"comment_userpic" => ($config['userpic'] && $comment_row[$i]['userpic']) ? ROOT_PATH."data/userpic/".$comment_row[$i]['userpic'] : "",
        
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0$config['wordwrap_comments'], 00),
        
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
        
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
        
"row_bg_number" => $row_bg_number,
        
"admin_links" => $admin_links
      
));

      if (
COMMENT_RATING_ANABLE)
      {
        
$comment_row[$i]['cat_id'] = $cat_id;
        
$comment_row[$i]['image_allow_comments'] = $image_allow_comments;
        
comment_rating_template($comment_row[$i]);
      }

      
$comments .= $site_template->parse_template("comment_bit");
    }
    
$return['comment'] = $comments;
    
$return['page'] = $page;
    
$return['perpage'] = $commentperpage;
    
$return['type'] = ($comments_all) ? 0;
  }
}


//-----------------------------------------------------
//--- Display results ---------------------------------
//-----------------------------------------------------
if (isset($HTTP_GET_VARS['js']) || isset($HTTP_POST_VARS['js'])) //do we need format return data for JavaScript?
{
  
$text "";
  if (
is_array($return))
  {
    foreach(
$return as $key => $val)
    {
      
$text .= ($text "|" "").$key."|".str_replace("|""&#38;#124;"$val);
    }
    echo 
"||".$text//add two "|" so if something was already printed, the javascript would not through out an error and ignore it.
  
}
  else
  {
    echo 
$return;
  }
  exit;
}
else
{
  if (!empty(
$return))
  {
    
$text "";
    if (
is_array($return))
    {
      
$text $return['msg'];
    }
    else
    {
      
$text $return;
    }
    
$site_sess->set_session_var("comment_msg"$text);
  }
  if (
$back_url $site_sess->get_session_var("back_url"))
  {
    
redirect($back_url);
  }
  
redirect(ROOT_PATH."index.php");
}
?>


and still not found thumbnail.
example:
http://thelifephotography.com/details.php?image_id=50
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 10, 2009, 08:11:54 AM
In your particular case you'll need insert that code below
unset($next_prev_cache);


Thanks! That was it!

So I do not need to add that to the ajaxcomments.php  ...

Is there someway I should know what to add and what not to add to the show comments ajax php for future mods?
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on March 10, 2009, 08:18:06 AM
This mod has nothing to do with comments ;)
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 10, 2009, 10:46:12 AM
I know... I dont want to polute this thread... but in that mod you said you had to copy all modifications to the ajaxcomments thread just like the details.php.....



I guess only those mods related to co0mments, not every kind of mod?
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on March 10, 2009, 02:03:32 PM
correct
Title: Re: [MOD] Photo Preview Hack
Post by: richtest on March 12, 2009, 10:07:56 PM
 :D I have installed this mode brilliant I must say I love it,  :?: but can anyone help me out I have noticed the images don’t keep to the top of the dotted border  how can I change the code to keep the images  to the top.

Example of the problem here  :roll:

http://www.numanme.co.uk/youtube-album/details.php?image_id=118 (http://www.numanme.co.uk/youtube-album/details.php?image_id=118)
Title: Re: [MOD] Photo Preview Hack
Post by: jotabonfim on March 22, 2009, 10:34:32 PM
Hello people, it is possible to display the thumbnails of images in vertical format as example below?

Thanks for the help



Example:

ThumbThumb
ThumbThumb
ThumbThumb
ThumbThumb
ThumbThumb
Title: Re: [MOD] Photo Preview Hack
Post by: KurtW on March 25, 2009, 06:09:53 AM
Hi richtest,

in details.php
search:
Code: [Select]
    $t_template .= "<td align=\"center\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";
replace with:
Code: [Select]
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";


Kurt
Title: Re: [MOD] Photo Preview Hack
Post by: richtest on March 27, 2009, 11:36:03 PM
thanks  KurtW :wink:
Title: Re: [MOD] Photo Preview Hack
Post by: KurtW on March 28, 2009, 09:57:06 AM
Hi,

Small update: 28.03.2009

http://www.4homepages.de/forum/index.php?topic=7294.msg124362#msg124362

- static html code now in details.html
- css for the tables now in style.css
- the thumbsize in previews: settings now easier to find in details.php


Kurt
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 30, 2009, 09:48:30 AM
Can you tell me is there a bennefit to making the code static? I have it working great and was woondering what the bennifits would be?

Thanks!
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on March 30, 2009, 10:24:06 AM
So later on "you" don't need to scratch your head in searching "where the hell is that <br /> came from?" ;)
All HTML code should be inside templates and not in .php files, it just makes easier for design customization.
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 30, 2009, 11:41:22 AM
Cool. It works much better. You read my mind... the next question i had was how to change background color of cell... Excellent forward thinking. Better improved useability.


Thanks. A great mod made even better.
Title: Re: [MOD] Photo Preview Hack
Post by: AntiNSA2 on March 30, 2009, 11:43:31 AM
how hard would it be to include the image preview thumbnails descriptions of each thumbnail in a nice jquery pop up window with rounded courners and adjustable font color?
Title: Re: [MOD] Photo Preview Hack
Post by: harinezumi on June 17, 2009, 03:52:52 PM
hi! thanks for a nice mod!  :D
and how can I turn off image names below thumbs?
Title: Re: [MOD] Photo Preview Hack
Post by: jotabonfim on July 10, 2009, 10:20:26 PM
this does not work!



Hi richtest,

in details.php
search:
Code: [Select]
    $t_template .= "<td align=\"center\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";
replace with:
Code: [Select]
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";


Kurt
Title: Re: [MOD] Photo Preview Hack
Post by: Sebas Bonito on July 21, 2009, 03:45:25 AM
How to change the count e.g. to only 4 images?
Title: Re: [MOD] Photo Preview Hack
Post by: jotabonfim on July 21, 2009, 05:16:54 PM
Help please!!


this does not work!



Hi richtest,

in details.php
search:
Code: [Select]
    $t_template .= "<td align=\"center\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";
replace with:
Code: [Select]
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<td align=\"center\" valign=\"top\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";


Kurt
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on July 21, 2009, 05:32:28 PM
Help please!!...

Quote
$t_template .= "<tr align=\"center\" valign=\"top\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<tr align=\"center\" valign=\"top\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";

test

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Sebas Bonito on July 26, 2009, 06:19:14 PM
:flag-en:
For standard I've chosen a pic (#7), if a category will build. But I'd
like to have a new "hack": If somebody has uploaded a picture and
cat_image in the uploaded category is the standard pic (in my case
"7"), it will choose the new uploaded picture. Is this possible?

:flag-de:
Standardmäßig ist es bei mir nicht "0", sondern "7" als Kategoriebild.
Nun möchte ich eine Ergänzung haben: Wenn ich oder ein User ein
Foto hochlädt und in der zu hochladenden Kategorie cat_image = 7
ist, dann soll das neue Bild die neue cat_image sein. Ginge das irgendwie?
Title: Re: [MOD] Photo Preview Hack
Post by: rinaldos on July 29, 2009, 02:25:40 PM
:flag-de:
Standardmäßig ist es bei mir nicht "0", sondern "7" als Kategoriebild.
Nun möchte ich eine Ergänzung haben: Wenn ich oder ein User ein
Foto hochlädt und in der zu hochladenden Kategorie cat_image = 7
ist, dann soll das neue Bild die neue cat_image sein. Ginge das irgendwie?

Hi,
das ist aber nicht dieser MOD. Dieser MOD zeigt die eine Anzahl kleiner Thumbnails auf der Detailansicht.... Gruß
Denke hier bist du besser aufgehoben ....
http://www.4homepages.de/forum/index.php?topic=6922.0

Ingo
Title: Re: [MOD] Photo Preview Hack
Post by: Sebas Bonito on July 29, 2009, 10:04:10 PM
Hi,
das ist aber nicht dieser MOD. Dieser MOD zeigt die eine Anzahl kleiner Thumbnails auf der Detailansicht.... Gruß
Denke hier bist du besser aufgehoben ....
http://www.4homepages.de/forum/index.php?topic=6922.0
Ingo

My brain is only air  :lol: Du hast absolut Recht. Danke!
Title: Re: [MOD] Photo Preview Hack
Post by: jotabonfim on August 03, 2009, 04:12:20 PM
Tank you Rembrandt!!!!! :P :P :P





Help please!!...

Quote
$t_template .= "<tr align=\"center\" valign=\"top\" style=\"border: 1px solid #004C75; background: #F1F1F1; padding: .1cm\">\n";
    } else {
    $t_template .= "<tr align=\"center\" valign=\"top\" style=\"border: 1px dashed #004C75; padding: .1cm\">\n";

test

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: leoseo on August 06, 2009, 12:00:06 PM
I've got a problem that this mod doesn't show the thumbnails if the page is reached through search page, as in www.site.com/img123.search.htm
It works OK when browsed normally; as in www.site.com/img123.htm

Any ideas?
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on August 06, 2009, 01:25:38 PM
...Any ideas?
no...
is irrelevant because you have a top secret web site  :)

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on August 09, 2009, 09:32:47 AM
Hi!

da öfter danach gefragt wurde wie man die bilderanzahl erhöhen kann, hier ein kleiner code update.
 damit ist es möglich ganz einfach die gewünschte anzahl der vorschaubilder einzustellen.

search:

if($lastPage < 6){
    $start = 0;
    $end = $lastPage -1;
} elseif ($act_key == 0 || $act_key == 1){
    $start = 0;
    $end   = 4;
} elseif ($act_key == $lastPage-1 || $act_key == $lastPage -2){
    $start = $lastPage - 5;
    $end = $lastPage - 1;
} else {
    $start = $act_key -2;
    $end   = $act_key +2;
}

and replace with:


$total = "7";  // always an odd number e.g. 5,7,9,11... e.t.c

if($lastPage < ($total + 1)){
    $start = 0;
    $end = $lastPage -1;
} elseif ($act_key <= (($total-1)/2 -1)){
    $start = 0;
    $end   = ($total - 1);
} elseif ($act_key >= $lastPage - (($total-1)/2)){
    $start = $lastPage - $total;
    $end = $lastPage - 1;
} else {
    $start = $act_key - ($total-1)/2;
    $end   = $act_key + ($total-1)/2;
}


mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: rinaldos on August 10, 2009, 12:19:52 PM
@rembrandt.
Danke für diese nette Erweiterung des MOD's :-) klappt einwandfrei :-)

LG
Ingo
Title: Re: [MOD] Photo Preview Hack
Post by: fermachado on September 25, 2009, 12:29:50 PM
Hi,

I have a problem with my details.php.

If try with a fresh copy of details.php works fine,but with my file of details.php just show a little square.I attach a image to show the problem.

My details.php

REMOVED
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on September 25, 2009, 04:08:01 PM
please attach your details.php to the post. this forum has a limit of allowed post length, posting entire file as text will not fit into that limit.

P.S.
attach two versions of your details.php:  with AND without the modification from this mod.
Title: Re: [MOD] Photo Preview Hack
Post by: fermachado on September 25, 2009, 04:24:40 PM
Thanks Vano,

I put the two files in attach.

The detailsclean.php is a fresh copy of deyails.php only have this mod

The details.php is the file I use inmy site and have more changes with others mod's.

Thanks
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on September 25, 2009, 04:38:16 PM
Ok, I've updated a little the installation instructions, now you'll need find different string in details.php,
It should work now with any mods
Title: Re: [MOD] Photo Preview Hack
Post by: fermachado on September 25, 2009, 07:21:09 PM
Thanks lot Vano,


I tried in my PC (localhost) and works very nice.Later make this changes in the site I have online.

Thanks for your work
Title: Re: [MOD] Photo Preview Hack
Post by: apaunganhote on October 16, 2009, 11:04:59 AM
I just installed it.

I don't know why it doesn't show Previous and Next Image anymore even I still have code in details.html. My previous and next code is like this

Code: [Select]
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr valign="top">
<td class="row2">{if prev_image_name}{lang_prev_image} <b><a href="{prev_image_url}">{prev_image_name}</a></b>
 <br /><br /><a href="{prev_image_url}"><img src="{prev_thumb_file}" border="1"></a>
{endif prev_image_name}</td>
<td align="right" class="row2">{if next_image_name}{lang_next_image} <b><a href="{next_image_url}">{next_image_name}</a></b>
 <br /><br /><a href="{next_image_url}"><img src="{next_thumb_file}" border="1"></a>
{endif next_image_name}</td>
</tr>
</table>

And another one thing i didn't clear is,

It's showing latest image for that category or Latest pic + Oldest Pic ?

Please kindly help me out.

Thanks.

With Regards,
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on October 16, 2009, 12:28:50 PM
Hi!
...
And another one thing i didn't clear is,

It's showing latest image for that category or Latest pic + Oldest Pic ?....
look at my detail page (http://www.vienna-pictures.com/details.php?image_id=1559), the horizontal images, is the hack.

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: apaunganhote on October 16, 2009, 05:43:19 PM
Hi!
...
And another one thing i didn't clear is,

It's showing latest image for that category or Latest pic + Oldest Pic ?....
look at my detail page (http://www.vienna-pictures.com/details.php?image_id=1559), the horizontal images, is the hack.

mfg Andi

Oops yeap, I got it.

I really like your site. Can i ask you one thing about EXIF info ? Is that mod ? The default EXIF info is not too much detail like that one right ? If that's mod, can you please kindly point me out where can i find it ?

And my one still cannot have Previous and Next button even there's code in the details page. Any idea please ?

Thank you.

With Regards,
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on October 16, 2009, 07:26:22 PM
... about EXIF info ? Is that mod ? The default EXIF info is not too much detail like that one right ? If that's mod, can you please kindly point me out where can i find it ?...

http://www.4homepages.de/forum/index.php?topic=21017.msg114214#msg114214

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: blastarhymes on October 22, 2009, 01:52:38 PM
awsome, thansk for this...will put it too good use:)
Title: Re: [MOD] Photo Preview Hack
Post by: Bogdan on December 10, 2009, 10:23:12 PM
Thank you for the great mod.

One question: what do I need to change to show the thumbnails aligned vertical:
Thumb1
Thumb2
Thumb3...

instead of  Thumb1 Thumb2 Thumb3

Thanks
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on December 11, 2009, 05:19:22 AM
Hi!
..
One question: what do I need to change to show the thumbnails aligned vertical:...
http://www.4homepages.de/forum/index.php?topic=7294.msg138957#msg138957

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Bogdan on December 11, 2009, 08:24:52 PM
Thanks Rembrandt
Title: Re: [MOD] Photo Preview Hack
Post by: surferboy on February 25, 2010, 10:07:49 AM
...
Thanks i like this one :D bro can we also add previous image next image on both side :D by any chance ?
in details.html:
Code: [Select]
{if prev_image_name}{lang_prev_image}<br />
                              <b><a href="{prev_image_url}">{prev_image_name}</a></b>
<br /><br /><a href="{prev_image_url}"><img src="{prev_thumb_file}" border="1"></a>
{endif prev_image_name}&nbsp;</td>
                            <td align="right" class="row2">
&nbsp;{if next_image_name}{lang_next_image}<br />
                              <b><a href="{next_image_url}">{next_image_name}</a></b>
<br /><br /><a href="{next_image_url}"><img src="{next_thumb_file}" border="1"></a>
{endif next_image_name}</td>

mfg Andi

Using 4images 1.7.7:

Got the Photo preview hack working. At first, it seemed to be perfect but now with 7 images in the category, only 5 are appearing in the preview. The 5 in preview are only the first 5 images.  Two new uploads are not appearing in the preview screen, even after I click on them in the detail page, the preview shows the first 5 only. 

Also, and perhaps related, the image previous and image next is not working. Am using the code listed above, for both the top and bottom of the details page.

What do I see? A blank grey table but no images or even links, just a wide bar.

Any ideas on how to resolve this?

Thanks,

Brian

[edit] - issue resolved.  see note here: an update for 1.7.7?

able to resolve issue; on a hunch, decided to try V@NO's advice in this post:
http://www.4homepages.de/forum/index.php?topic=7294.msg133435#msg133435

moved the photo preview hack code for details.php to the location specified by V@NO and badda bing, it worked.

not sure if this is good advice for ALL 1.7.7 users, but that was able to resolve the display of the links and show prev/next images;  also, this fixed the photo preview hack that was only showing the first 5 images even after you clicked on the 6th or 7th image.

- Brian
Title: The Rise of the Evil Eye
Post by: surferboy on February 27, 2010, 10:00:49 PM
Hi -

Using v1.7.7

The Photo Preview Hack MOD is working great. I uploaded an image to our gallery that measured 2592 x 1944.

I have installed the auto image resize MOD.  Settings on the control panel: width: 818 - height: 1024

Checked the pic after upload for the correct size by using the MeasureIt tool for Firefox.  Photo measures 818 wide.

The problem: click on the home page, then click on 'New Images.'  Look for the new image in the table, and click on it. The result is the image attached:

the Evil Eye appears in the photo preview panel above to the current photo.

Does this issue appear if I go to the home page and then click on the same new image? No. It shows one photo in the photo preview panel, in yellow (my css mod there).

Conclusion: the overlapping of categories in the 'search' feature causes the evil eye to appear in the photo preview panel.  I tried clicking on other images  in the 'New Images' search page, and the same thing happened, more rise of the Evil Eye.

Any ideas what could be causing this?

Thanks,

Brian
Title: Re: [MOD] Photo Preview Hack
Post by: bergblume on February 28, 2010, 12:33:07 PM
super sache, dieser MOD!!!

ist es auch möglich, dass man die preview bilder auf Basis der GPS-Infos (basierend auf dem [MOD] Google Map) ausgegeben bekommt?
sprich es werden als preview bilder die bilder angezeigt, die am nähesten vom angezeigten Bild liegen?

gruss, bergblume
Title: Re: [MOD] Photo Preview Hack
Post by: surferboy on February 28, 2010, 07:32:59 PM
Quote
super sache, this MOD!

It is also possible that you get the preview images on the basis of the GPS information (based on the output [MOD] Google Map)?
speak it as a preview images are displayed images that are closest to the displayed image?

gruss, mountain flower

I suppose but I don't have the Google Map MOD enabled

- Brian
Title: Re: [MOD] Photo Preview Hack
Post by: satine88 on May 16, 2010, 11:53:03 AM
Hi,

[MOD] Photo Preview Hack ....

Thanks ! :)




fullquote removed @Rembrandt
Title: Re: [MOD] Photo Preview Hack
Post by: ilaslan on August 18, 2010, 09:51:19 PM
hello . iam new 4images.
 i love this mod hacks. i am using 1.7.8 .
But when i use this mod hack  next_image_url is always null = and next , previeus link is not working ( and click main image go to next images ).  Some friends has said this problem but i dont see any solve. only surferboy said that
Quote


[edit] - issue resolved.  see note here: an update for 1.7.7?

able to resolve issue; on a hunch, decided to try V@NO's advice in this post:
http://www.4homepages.de/forum/index.php?topic=7294.msg133435#msg133435

on http://www.4homepages.de/forum/index.php?topic=7294.msg145881#msg145881 (http://www.4homepages.de/forum/index.php?topic=7294.msg145881#msg145881)

but i didnt understand solve

vano says :

Quote
In your particular case you'll need insert that code below
   
Code: [Select]
unset($next_prev_cache);
edit : this hack codes must insert below unset($next_prev_cache);  No problem

Regards
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on August 26, 2010, 09:46:35 PM
what does this MOD do, links on demos are dead
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on August 27, 2010, 05:43:08 AM
what does this MOD do, links on demos are dead

Demo (http://www.demo.vienna-pictures.com/details.php?image_id=1)

the image row above the line  "Wetter Information vom Aufnahmeort"
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on August 27, 2010, 04:15:21 PM
@Remembrant

On step 3 it says find ?> in the styl.css, but there is no ?> inside of css because its not php.
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on August 27, 2010, 05:58:52 PM
@Remembrant

On step 3 it says find ?> in the styl.css, but there is no ?> inside of css because its not php.
paste it wherever you want in the style.css
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on September 08, 2010, 06:03:23 PM
@remambrant

this mod only shows the first 5 images and thats it? when i click next next next next next then inside the page the image changes but the previous hack does not. It is still on the first 5 images. Is there a way that after the 5 image a new set of 5 images appear?? please  :mrgreen: thank you
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on September 08, 2010, 06:37:47 PM
@remambrant
^
this is not a member from 4images forum, but perhaps I can help you...  :roll:

Quote
this mod only shows the first 5 images and thats it? ..
you mean, your mod  :mrgreen:

post your code from details.php and the code from the details.html
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on September 08, 2010, 09:53:56 PM
Remembrant

Please forgive me. Of course i know you arent a 4images member  :lol: :lol: :lol:... Number 1 the reason is because only administrators like yourself make the coolest MODS which i have integrated from the likes of yours and mewazni and of course vano. Also and this is the easiest. Another reason how i know your arent a 4images member, is because if you had created this modification yourself, im 100% sure i would not have had any problems regarding its implemention.  :mrgreen:

 
********
Update, http://www.4homepages.de/forum/index.php?topic=7294.msg145881#msg145881 (http://www.4homepages.de/forum/index.php?topic=7294.msg145881#msg145881) this is exactly the problem i am facing and it actually worked. Im so so so sory for wasting your time remembrant, but i  will next time read first ask later hehehe  :mrgreen:

Update number 2 lol ***

I actually do had 1 small request. Is there any way to make the dimensions of the thumbnails to be all the sme even the thumbnails of movies and thumbnails of media sites aand mp3. all have 1 demension and also i want to remove the name of the image i just want the image to appear thats all. I hope u can help me on this one  :mrgreen:
Title: Re: [MOD] Photo Preview Hack
Post by: V@no on September 09, 2010, 01:08:26 AM
:offtopic:
one word: dyslexia (http://health.google.com/health/ref/Developmental+reading+disorder)

Having some symptoms myself I tend to copy/paste people's names rather then typing them and get into situation like this one...
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on September 09, 2010, 02:59:12 AM
 :( :( :( :(

@ Rembrandt not remembrant

Please forgive me. I sincerely apologize. Upon you telling me that remembrant was not a member here i thought that you meant I was being disrespectful to you by talking to you as a member and not as a respected administrator/moderator. It was only after i realized what you had meant by this comment. I sincerely apologize and please forgive me. It will not happen again. I hope you are not angry or upset with me  :(.

@Vano

I very much also sincerely apologize. I did not mean to be disrespectful what so ever.  :( I actually do have a mild form of dyslexia which i havent told anyone about. For some reason when im nervous or under pressure like standing up infront of the class and talking. The words just dont make sense and in very small occasions like when i said remembrant :cry:

I am really sorry guys. Please if I have annoyed you or any of your fellow workers i will discontinue use of this forum, you just have to say the word. I dont want to make anyone here angry. You guys have been there with support whenever ive needed it and if i have upset anyone please do say .

Im very soory again rembrandt and voano lol i mean vano  (whis) :)
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on September 09, 2010, 09:18:24 AM
so.. i have recoded the photo preview hack

1.) install this mod: http://www.4homepages.de/forum/index.php?topic=25017.msg137021#msg137021
and the addon:   http://www.4homepages.de/forum/index.php?topic=25017.msg138624#msg138624

2.) search in root/details.php:
 //-----------------------------------------------------
//--- Save Comment ------------------------------------
//-----------------------------------------------------

insert above:

//##################################### Start MOD: Photo Preview Hack ###################################

$total = "7"; // always an odd number e.g. 5,7,9,11... e.t.c
$center = 1; // for table-width 100% set 0;

  $result = $site_db->query($sql);
    while($row = $site_db->fetch_array($result)){
      $image_preview[] = $row['image_id'];
      $preview_row[$row['image_id']] = $row;
    }

    $lastPage = count($image_preview);

      if ($center == 1){
        $t_template = "<table align=\"center\" width=\"10%;\">\n";
      }
      else{
        $t_template = "<table width=\"100%;\">\n";
      }  
        $t_template .= "<tr>";

      if($lastPage < ($total + 1)){
        $start = 0;
        $end = $lastPage -1;
      }
      elseif ($act_key <= (($total-1)/2 -1)){
        $start = 0;
        $end   = ($total - 1);
      }
      elseif ($act_key >= $lastPage - (($total-1)/2)){
        $start = $lastPage - $total;
        $end = $lastPage - 1;
      }
      else {
        $start = $act_key - ($total-1)/2;
        $end   = $act_key + ($total-1)/2;
      }

      for($i=$start; $i<=$end; $i++){
        if ($preview_row[$image_preview[$i]]['image_id'] == $image_row['image_id']) {
          $t_template .= "<td class=\"minirow1\">\n";
        }
        else {
          $t_template .= "<td class=\"minirow2\">\n";
        }
    
        $t_template .= get_thumbnail_small_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
        $t_template .= "</td>";
      }

      $t_template .= "</tr>";
      $t_template .= "</table><br>\n";
      $site_template->register_vars("preview_box", $t_template);
unset($image_preview);
//######################################## End MOD: Photo Preview Hack  #######################################


3.) search in your Templates/details.html:
Code: [Select]
{endif msg}insert below:
Code: [Select]
{if preview_box}
  {preview_box}
{endif preview_box}

4.) insert in your Templates/style.css
Code: [Select]
.minirow1 {
padding:4px;
background-color : #FFFFFF;
text-align : center;
vertical-align : middle;
border : 1px solid #004C75;
}

.minirow2 {
padding:4px;
background-color : #FFFFFF;
text-align : center;
vertical-align : middle;
border : 1px solid #CCCCCC;
}

in the top of the code, can you set how many images you preview , and the table width.

i think it is all say over the mod.

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: zakaria666 on September 09, 2010, 07:53:45 PM
@Rembrandt

Very amazing 1. Thanks man. It is exactly the way i wanted it. Looks very cool and now it looks very neat. thank you 100x  :thumbup:


thanks man
Title: Re: [MOD] Photo Preview Hack
Post by: x23piracy on December 07, 2010, 01:40:50 AM
Hi Andi,

probier mal folgendes js mit deiner mod aus ist ne nette Ergänzung finde ich:
Hier ne Demo: http://www.dynamicdrive.com/dynamicindex4/expandoimage.htm (http://www.dynamicdrive.com/dynamicindex4/expandoimage.htm)

EDIT:
Ich hab das mal eingebaut (Bild anklickbar Youtube Video):
(Da wo was passiert ist auch der Mauszeiger... ich hab mal wieder vergessen den für die Aufnahme einzuschalten)
(http://www.xup.in/pic,15520155/temp.jpg) (http://www.youtube.com/watch?v=HHp8k7JqCkI)

Weißt du wie man die Ecken der Thumb abrunden kann ohne das wirklich zu tun?
Ich habe schonmal an ein div gedacht aber mit einem transparenten png wird das klappen wenn der Hintergrund
an den abgerundeten Ecken sichtbar sein soll) Idee?


EDIT2:

Ich habe was gefunden für die runden Ecken:
http://maestric.com/doc/css/rounded_corners_images (http://maestric.com/doc/css/rounded_corners_images)

Damit kannst du dem img einfach ne class verpassen und die ecken werden rund.
Frage kann man einem Objekt auch zwei classen verpassen? <-- (Weiß ich schon class="class1 class2")

(http://maestric.com/wiki/lib/exe/fetch.php?w=&h=&cache=cache&media=css:gif_vs_png.png)

Schade ist nur das es nicht mit Hintergrundfotos funktioniert, die ecken haben immer einen festen
Farbwert... doof ich dachte eigentlich sowas geht irgendwie... :)


EDIT3:

...und das hier wäre mein Favorit: http://www.webdesignerwall.com/demo/jquery-css3-rounded-img/ (http://www.webdesignerwall.com/demo/jquery-css3-rounded-img/)
Ist echt schick aber funktioniert im IE garnicht (bleibt aber ansehnlich), der Firefox und Safari spielen mit :)
Chrome hat dem Stil ohne schwarze border Probleme... Opera mit genau dem anderen... lol

Screenshot:

(http://www.xup.in/pic,42742543/temp.jpg) (http://www.xup.in/dl,42742543/temp.jpg/)

Funktioniert auch mit Hintergrundfotos:

(http://www.xup.in/pic,13323035/temp.jpg) (http://www.xup.in/dl,13323035/temp.jpg/)


Gruß Jens
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on December 07, 2010, 05:31:54 AM
das mit den abgerundeten bilder hatten wir schon hier:  http://www.4homepages.de/forum/index.php?topic=26792.msg146041#msg146041
kannst es ja mal mit den versuchen.

und den mac style gibt es hier: http://www.4homepages.de/forum/index.php?topic=27910.msg151065#msg151065
Title: Re: [MOD] Photo Preview Hack
Post by: x23piracy on December 07, 2010, 05:54:22 AM
Hi,

das mit den abgerundeten bilder hatten wir schon hier:  http://www.4homepages.de/forum/index.php?topic=26792.msg146041#msg146041
kannst es ja mal mit den versuchen.

danke das ist interessant.

und den mac style gibt es hier: http://www.4homepages.de/forum/index.php?topic=27910.msg151065#msg151065

Wo hab ich denn danach gefragt, du hast da was falsch verstanden es ging darum
den Photopreview Hack im das aufzoomen der Thumbs auf Thumb-Originalgröße das klappt ja.

Video nicht gesehen?


Gruß Jens
Title: Re: [MOD] Photo Preview Hack
Post by: haider512 on March 06, 2011, 12:06:48 PM
wow...i like your details page thing..how did you do that mate..??
it is 4images right.. its very kool..

link to video (http://www.youtube.com/watch?v=HHp8k7JqCkI)



image removed @Rembrandt
Title: Re: [MOD] Photo Preview Hack
Post by: x23piracy on March 11, 2011, 03:39:37 AM
Hi,

iam no more active here.
If you like contact me via email.

I can give you my source root but you need to customize a lot.

That is not a ready to use template.


Greetz X23
Title: Re: [MOD] Photo Preview Hack
Post by: mrkaswa on April 30, 2011, 10:37:53 AM
Hello,  I could use a little help please. 
I have tried to follow along as best I could but,  instead of 7 thumbnails across the top I just get little boxes and I am just not sure where I went wrong. I've attached an image that should explain what I mean.


Thanks
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on April 30, 2011, 10:55:33 AM
search in the code (step.2):
get_thumbnail_small_code
and replace:
get_thumbnail_code
Title: Re: [MOD] Photo Preview Hack
Post by: mrkaswa on April 30, 2011, 12:30:29 PM
Thank you! That took care of it right away,  tho I suspect you knew that it would :D

I'm perfectly happy with this arrangement but if I can ask...I thought i saw that I changed some code in step 1 to allow for small thumbnails?  Did I make a mistake there?

Also just thought I would ask,  do you know of any mod that allows for the image to be changed without a refresh of the entire page?


Again,  thanks for your help with the thumbnails!

Edited to add that I started over with clean details.php and function.php files and after doing the mod to the functions.php but not the add on yet I can create and display small thumbnails.
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on April 30, 2011, 02:45:38 PM
..I'm perfectly happy with this arrangement but if I can ask...I thought i saw that I changed some code in step 1 to allow for small thumbnails?  Did I make a mistake there?
...
i think yes, post your functions.php as attachment
Title: Re: [MOD] Photo Preview Hack
Post by: mrkaswa on May 09, 2011, 01:14:55 PM
Here is the functions.php
I am pretty happy with the normal sized thumbnails so there is no panic here,  but if I am reading the mod correctly it should be possible to actually use this to make bigger thumbnails by changing the max width to something larger?  that is something I would enjoy.

Thanks again.
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on May 10, 2011, 05:43:10 AM
... but if I am reading the mod correctly it should be possible to actually use this to make bigger thumbnails by changing the max width to something larger?  that is something I would enjoy.
should work..

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Nosferatu on June 20, 2011, 03:38:57 PM
danke !!

mod lauft super mit 1.7.10
http://www.pj-firepower.com/picgallerie/details.php?image_id=11325
Title: Re: [MOD] Photo Preview Hack
Post by: Nosferatu on May 26, 2012, 05:09:37 PM
Hallo,

ich hab da ein komisch problem, bis jetzt hatte ich es nur bei vereinzelten bildern, das oben die fotos nicht angezeigt werden, da wars mir egal, da es mir selbst bei 3 stück aufgefallen ist.

Aber jetzt ist es so das ich auf einmal, bei ganze alben das problem habe lol

Beispiel: Smartphone Gallery
http://www.wallpapers-heaven.com/categories.php?cat_id=421

Klickt irgend ein Bild direkt in der Gallery an z.b.:
http://www.wallpapers-heaven.com/details.php?image_id=10229

Da funktioniert es.

Jetzt klickt ein Album an bei Smartphone
und sucht euch dort ein Bild aus zb.:
http://www.wallpapers-heaven.com/details.php?image_id=32115

Ne ahnung warum, das mal angezeigt wird und dann nicht ? betrifft aber alle alben bei smartphone...

mfg
jeff
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on May 26, 2012, 06:06:47 PM
Hi!
....Jetzt klickt ein Album an bei Smartphone
und sucht euch dort ein Bild aus zb.:
http://www.wallpapers-heaven.com/details.php?image_id=32115

Ne ahnung warum, das mal angezeigt wird und dann nicht ? betrifft aber alle alben bei smartphone...
..
Zum einen was hat das mit diesen Mod zu tun, auf der Seite die du verlinkt hast gibt es diesen Mod nicht.
Zum anderen werden wenn du die Detailbilder meinst, alle Bilder angezeigt.

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Nosferatu on May 26, 2012, 07:21:08 PM
Was heißt den Mod gibts nicht Oo....

Ist das nicht der Mod wo oben die Preview Bilder angezeigt werden ?
Dann sorry... dann habe ich das bei mir am rechner falsch gespeichert :(

werden bei dir

bei beiden seiten:

1) http://www.wallpapers-heaven.com/details.php?image_id=10229
2) http://www.wallpapers-heaven.com/details.php?image_id=32116

oben die 5 bilder angezeigt ?

edit: habe gerade in meiner details.php nachgeschaut... es ist der mod .... nur auf der page selbst wird irgendwie nicht ###MOD: Photo Preview Hack... angezeigt... ka warum..


mfg jeff
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on May 26, 2012, 07:40:31 PM
....bei beiden seiten:

1) http://www.wallpapers-heaven.com/details.php?image_id=10229
2) http://www.wallpapers-heaven.com/details.php?image_id=32116

...
in deinen vorigen post war der Mod bei deinen Links nicht zu sehen, darum mein Kommentar.
jetzt beim ersten Link ist der Mod inkl der Bilder zu sehen, bei dem zweiten Link ist nicht einmal der Mod zu sehen.

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: Nosferatu on May 26, 2012, 08:24:53 PM
ja nur warum ??? ich hab da nichts spezielles eingebaut....

warum zeigt er es mal und dann wieder nicht
Title: Re: [MOD] Photo Preview Hack
Post by: Jan-Lukas on May 26, 2012, 11:44:22 PM
Habe mir Link 1 + 2 angesehen, bin dann aber wieder zu Link 1 gegangen.... bin da immer noch  :oops:
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on May 27, 2012, 11:30:40 AM
ja nur warum ??? ich hab da nichts spezielles eingebaut....
...
Irgend etwas muß ja sein, sonst würde die vorschau ja immer funktionieren.
zip mal deine details.php und .html.
Title: Re: [MOD] Photo Preview Hack
Post by: Nosferatu on June 02, 2012, 11:14:20 AM
:)

meine dateien im anhang :)

bei den einen kategorien ist es extrem.... sonst hatte ich es nur ab und zu bemerkt...

ich hatte auch angenommen, das es am import batch liegt... und da irgendwas gemacht wird mit den bildern oder so ...

aber bei den anderen gibts auch wieder keine probleme hm...
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on June 02, 2012, 05:51:35 PM
.meine dateien im anhang :)
..
die details.html ist nicht die gleiche wie auf der webseite

mfg Andi
Title: Re: [MOD] Photo Preview Hack
Post by: PamBreeze on September 11, 2013, 09:40:42 PM
Is there a way to have this mod work with zip files that have thumb nails?
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on January 27, 2014, 05:11:53 PM
search in the [MOD] Photo Preview Hack

$t_template .= get_thumbnail_small_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);


and replace:

$t_template .= get_thumbnail_code($preview_row[$image_preview[$i]]['image_media_file'], $preview_row[$image_preview[$i]]['image_thumb_file'], $preview_row[$image_preview[$i]]['image_id'], $preview_row[$image_preview[$i]]['cat_id'], format_text(trim($preview_row[$image_preview[$i]]['image_name']), 2), $mode, 1);
Title: Re: [MOD] Photo Preview Hack
Post by: wallward on January 27, 2014, 06:19:10 PM
thank you,  :P
and how add class to minirow2 image
<img class="grayscale".....
Title: Re: [MOD] Photo Preview Hack
Post by: Rembrandt on January 27, 2014, 08:40:44 PM
see in the code:


          $t_template .= "<td class=\"minirow1\">\n";
        }
        else {
          $t_template .= "<td class=\"minirow2\">\n";