• [Mod] Photo Of The Day 4 0 5 1
Currently:  

Author Topic: [Mod] Photo Of The Day  (Read 269902 times)

0 Members and 1 Guest are viewing this topic.

Offline helluvaguy

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
[Mod] Photo Of The Day
« Reply #90 on: May 11, 2003, 07:57:54 PM »
Am I guessing right, that
Code: [Select]
c.cat_id != 2would exclude category 2 and
Code: [Select]
c.cat_id > 4would exclude categories 1, 2 and 3?

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Photo Of The Day
« Reply #91 on: May 12, 2003, 08:46:56 AM »
yes, you're right.

Offline artpapa

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #92 on: May 19, 2003, 01:46:04 AM »
Quote from: SLL
Code: [Select]
#############################################################################################
## Title: Photo Of The Day for 4images - Image Gallery Management System.
## Version: 1.2
## Author: Silly Little Lamer <sll@dalnet.ru>
## Description: This Mod shows so called "Photo Of The Day" on the first (and/or any
##        other page of your gallery. Dependning on your settings, the first of the
##        Top Images is selected by rating, number of votes, comments, downloads or hits
##        and its thumbnail is shown as a "Photo Of The Day".
##
## Installation Level:    Easy
## Installation Time:    10 Minutes
##
## Files To Edit: 4
##    /includes/functions.php
##    /includes/page_header.php
##    /includes/constants.php
##    /lang/english/main.php
##
#############################################################################################


demo: http://faces.dalnet.ru/index.php?l=english
download: http://www.dalnet.ru/files/4images/


Dear SLL,
Is there any opportunity to display "Photo Of The Day" outside of gallery folder in the static HTML files?

Zaranee blagodaru,

Alexei

www.artpapa.com
www.artpapa.com/gallery

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: [Mod] Photo Of The Day
« Reply #93 on: May 19, 2003, 09:01:13 AM »
Quote from: artpapa
Is there any opportunity to display "Photo Of The Day" outside of gallery folder in the static HTML files?

You should combine two MOD's for this: install Random Image MOD and then change it's original SQL query to the query from this MOD

Offline artpapa

  • Newbie
  • *
  • Posts: 31
    • View Profile
[Mod] Photo Of The Day
« Reply #94 on: May 20, 2003, 08:08:24 AM »
Thank you,
I will probably wait with this improvement until learn a bit more.

Another question: do you think it will be possible instead a picture of the day to do three pictures of the day, like a first, second and third place?

Offline Yegor

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
    • http://www.planetboredom.net
[Mod] Photo Of The Day
« Reply #95 on: May 25, 2003, 08:52:10 AM »
Im interested in this too,
SLL, do it for a fellow russian! :D
PlanetBoredom.net
 - Things to do when you are bored.  [ Advertise ]

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
PODT outside 4images directory
« Reply #96 on: May 25, 2003, 09:21:57 AM »
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
define&#40;'SITE_URL', 'http&#58;//www.mygallery.com/'&#41;;

include_once&#40;ROOT_PATH.'config.php'&#41;;
include_once&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;
include_once&#40;ROOT_PATH.'includes/constants.php'&#41;;

define&#40;'PIC_CATEGORIES_TABLE', '4images_categories'&#41;;
define&#40;'PIC_IMAGES_TABLE', '4images_images'&#41;;

$pics_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;

function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

switch &#40;POTD_SELECT_MODE&#41; &#123;
case "by_rating" &#58; $select_mode = "a.image_rating"; break;
case "by_votes" &#58; $select_mode = "a.image_votes"; break;
case "by_comments" &#58; $select_mode = "a.image_comments"; break;
case "by_downloads" &#58; $select_mode = "a.image_downloads"; break;
case "by_hits" &#58; $select_mode = "a.image_hits"; break;
&#125;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM "
.PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat="
.AUTH_ALL." AND b.auth_viewimage=".AUTH_ALL."
ORDER BY 
$select_mode DESC
LIMIT 1"
;

$row $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo 
"Selected by rates<br>\n";

?>


save as potd.php and then include as <?php include("./potd.php"); ?> into your site index.php

Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
[Mod] Photo Of The Day
« Reply #97 on: May 25, 2003, 10:01:55 AM »
is it possible to insert this php i a html site on a other server?

btw. I got this error:
DB Error: Bad SQL Query: SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits FROM 4images_images a, 4images_categories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0 ORDER BY DESC LIMIT 1
You have an error in your SQL syntax near 'DESC LIMIT 1' at line 4
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!


Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Photo Of The Day
« Reply #98 on: May 25, 2003, 10:11:55 AM »
Quote from: balu
is it possible to insert this php i a html site on a other server?

no
Quote from: balu
btw. I got this error:

original POTD mod has to be installed first.

Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
[Mod] Photo Of The Day
« Reply #99 on: May 25, 2003, 10:19:13 AM »
thx for quick response!
I have two pages - one forum that is a php-forum (other domain) and 4images - is this then possible?

What script have I to install first?
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!


Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
[Mod] Photo Of The Day
« Reply #100 on: May 25, 2003, 11:25:21 AM »
now I have installed the potd mod, but there is no pic on screen
may be you have a look into?
http://www.coverengine.de/pod.php

I change this in the .php-file:
Quote
<?php
define('ROOT_PATH', './4images/');
define('SCRIPT_URL', 'http://www.coverengine.de/4images/');

include_once(ROOT_PATH.'config.php');
include_once(ROOT_PATH.'includes/db_mysql.php');
include_once(ROOT_PATH.'includes/constants.php');

define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');

$pics_db = new Db($db_host, $db_user, $db_password, $db_name);

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

switch (POTD_SELECT_MODE) {
    case "by_rating"    : $select_mode = "a.image_rating"; break;
    case "by_votes"        : $select_mode = "a.image_votes"; break;
    case "by_comments"    : $select_mode = "a.image_comments"; break;
    case "by_downloads"    : $select_mode = "a.image_downloads"; break;
    case "by_hits"        : $select_mode = "a.image_hits"; break;
}

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
        FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
        WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=".AUTH_ALL." AND b.auth_viewimage=".AUTH_ALL."
        ORDER BY $select_mode DESC
        LIMIT 1";

$row = $pics_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>\n";

echo "<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo "Selected by rates\n";

?>
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!


Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Photo Of The Day
« Reply #101 on: May 25, 2003, 01:00:34 PM »
Hmm.. looks OK... as you can see at your site, no one pic and category given out from SQL query.

As an idea - check permitions in your 4images, if everybody allowed to see pics, not registered/logged-in only. Or remove all references to AUTH_ALL in this code

Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
[Mod] Photo Of The Day
« Reply #102 on: May 25, 2003, 01:33:51 PM »
which line I have to delete?

THX for the quick answer!!!

btw. is it possible to view 4 pictures? mot voted, most download, most view, most rate in 1 row?
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!


Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
[Mod] Photo Of The Day
« Reply #103 on: May 25, 2003, 01:59:16 PM »
Quote from: balu
which line I have to delete?

Code: [Select]
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_comments, a.image_downloads, a.image_votes, a.image_rating, a.image_hits
FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b
WHERE a.image_active=1 AND a.cat_id = b.cat_id
ORDER BY $select_mode DESC
LIMIT 1";

Quote from: balu
btw. is it possible to view 4 pictures? mot voted, most download, most view, most rate in 1 row?

you have to make 4 copies of sql query and set different $select_mode for each one.

Offline balu

  • Newbie
  • *
  • Posts: 25
    • View Profile
    • http://www.coverengine.de/4images
[Mod] Photo Of The Day
« Reply #104 on: May 25, 2003, 02:06:17 PM »
The whole???
I deleted it but still no pic!
I am a total newbie in php, how must realize this?

Is it possible in a table with 4 columns?

Very many thx

that is what the .php gives out, maybe there is the mistake?
<a href="http://www.coverengine.de/4images/details.php?image_id="><img src="http://www.coverengine.de/4images/data/thumbnails//" border="0" alt=""></a>
<b><div class="ltgreytext"></b></div>
Selected by rates
Jürgen
-------------------------------------------------------
Wer Rechtschreibfehler findet, darf sie behalten!