Author Topic: Autoviewer for 4images  (Read 4986 times)

0 Members and 1 Guest are viewing this topic.

Offline Alessio

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Webax.it [Alessio's photogallery]
Autoviewer for 4images
« on: January 03, 2009, 09:53:49 PM »
I'm going to install a viewer similar to Tiltviewer (http://www.4homepages.de/forum/index.php?topic=20789.0).
It's called Autoviewer: http://www.airtightinteractive.com/projects/autoviewer/index.html

I'm writing the file autoviewer.php that is very similar to tiltviewer.php.
I need to indicate the width and the height of the photos but I don't know how to do it.
http://www.airtightinteractive.com/projects/autoviewer/manual_instruct.html
Example:

Code: [Select]
<image>
<url>images/wide.jpg</url>
   <caption>This is a caption.</caption>
   <width>700</width>
   <height>465</height>
</image>

Here is my file autoviewer.php, could you help me?

Code: [Select]
<?php
/**************************************************************************
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *             File: tiltviewer.php by mawenzi                            *
 *     File-Version: 1.0 - 26.02.2008                                     *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.x                                                *
 *************************************************************************/
define('GET_CACHES'1);
define('ROOT_PATH''./');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_date, i.image_active, i.image_media_file, c.cat_name".get_user_table_field(", u.""user_name")."
        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_active = 1 AND i.cat_id = '98' AND i.cat_id IN ("
.get_auth_cat_sql("auth_viewcat").")
        ORDER BY i.cat_id DESC
LIMIT 0,20
        "
;
  
$result $site_db->query($sql);
  echo 
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
  echo "<gallery frameColor=\"0xFFFFFF\" frameWidth=\"1\" imagePadding=\"5\" displayTime=\"6\" enableRightClickOpen=\"true\">";
  while ($image_row = $site_db->fetch_array($result)){
       echo "<image>";
       echo "<url>".ROOT_PATH."data/media/".$image_row['cat_id']."/".$image_row['image_media_file']."</url>";
       echo "<caption>".multilang($image_row['image_name'])."</caption>";
       echo "<width>????</width>";
       echo "<height>????</height>";
       echo "</image>";
  } // end while
  echo "</gallery>";
?>
« Last Edit: January 04, 2009, 01:40:41 AM by Alessio »
Alessio
my homepage: http://www.webax.it

Offline Alessio

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Webax.it [Alessio's photogallery]
Re: Autoviewer for 4images
« Reply #1 on: January 06, 2009, 10:12:14 AM »
Help me, please!
Alessio
my homepage: http://www.webax.it

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Autoviewer for 4images
« Reply #2 on: January 06, 2009, 11:19:34 AM »
Hi Alessio ...

... try the following ...
... add after ...
Code: [Select]
while ($image_row = $site_db->fetch_array($result)){

... this ...
Code: [Select]
$image_url = ROOT_PATH."data/media/".$image_row['cat_id']."/".$image_row['image_media_file'];
$image_info = @getimagesize($image_url);
$image_width = $image_info[0];
$image_height = $image_info[1];

... and use this in your xml code ...
Code: [Select]
echo "<url>".$image_url."</url>";
...
echo "<width>".$image_width."</width>";
echo "<height>".$image_height."</height>";
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Alessio

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • Webax.it [Alessio's photogallery]
Re: Autoviewer for 4images
« Reply #3 on: January 26, 2009, 09:16:13 AM »
Thank you Mawenzi!
Now it works correctly!

autoviewer.php

Code: [Select]
<?php
/**************************************************************************
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *             File: tiltviewer.php by mawenzi                            *
 *     File-Version: 1.0 - 26.02.2008                                     *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.x                                                *
 *
 *************************************************************************/
define('GET_CACHES'1);
define('ROOT_PATH''./');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
$sql "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_date, i.image_active, i.image_media_file, c.cat_name".get_user_table_field(", u.""user_name")."
        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_active = 1 AND i.cat_id = '98' AND i.cat_id IN ("
.get_auth_cat_sql("auth_viewcat").")
        ORDER BY i.cat_id DESC
LIMIT 0,75
"
;
  
$result $site_db->query($sql);
  echo 
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
  echo "<gallery frameColor=\"0x5c5c5c\" frameWidth=\"0\" imagePadding=\"5\" displayTime=\"4\" enableRightClickOpen=\"false\">";
  while ($image_row = $site_db->fetch_array($result)){
  $image_url = ROOT_PATH."data/media/".$image_row['cat_id']."/".$image_row['image_media_file'];
  $image_info = @getimagesize($image_url);
  $image_width = $image_info[0];
  $image_height = $image_info[1];
       echo "<image>";
       echo "<url>".$image_url."</url>";
       echo "<caption>".multilang($image_row['image_name'])."</caption>";
       echo "<width>".$image_width."</width>";
       echo "<height>".$image_height."</height>";
       echo "</image>";
  } // end while
  echo "</gallery>";
?>
Alessio
my homepage: http://www.webax.it