Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - V@no

Pages: 1 ... 8 9 10 11 [12] 13 14
166
This mod will let visitors download all images from a category.
Almost the same as Lightbox, exept that it will download pictures that are desplaeyed on one page (u can see what I mean here look at ZIP button near UPLOAD).
Why is it BETA? - because I've tested only on my own server/system, and it didnt work well with too many images or too big filesizes. It might be because of wrong my server configuration....dont know.... 8O

so, anyway.
1. Open categories.php file.
1.1. Find:
Code: [Select]
$site_template->register_vars(array(
  "msg" => $msg,
Replace with:
Code: [Select]
if (!check_permission("auth_download", $cat_id)) {
  $download_button = "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
  $download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
}
$site_template->register_vars(array(
  "download_button" => $download_button,
  "msg" => $msg,

2. Open download.php file.
2.1 Find:
Code: [Select]
$user_access = get_permission();Add after:
Code: [Select]
include(ROOT_PATH.'includes/page_header.php');
if (!function_exists('get_file_data'))
{
  function get_file_data($filename)
  {
    return file_get_contents($filename);
  }
}
2.2. Find:
Code: [Select]
 else {
    echo $lang['download_error']."\n<!-- EMPTY FILE PATH //-->";
    exit;
  }
}
Add after:
Code: [Select]
elseif ($action == "page") {
  if (!function_exists("gzcompress") || !function_exists("crc32")) {
    header("Location: ".$site_sess->url($url, "&"));
    exit;
  }

//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\

$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
        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 = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort']."
        LIMIT ".$_GET['offset'].", $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$page_download = "";
while ($image_row = $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql = trim($page_download, ", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
  $sql = "SELECT cat_id, image_media_file, image_download_url
          FROM ".IMAGES_TABLE."
          WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
  $result = $site_db->query($sql);
  if ($result) {
    include(ROOT_PATH."includes/zip.php");
    $zipfile = new zipfile();
    $file_added = 0;
    while ($image_row = $site_db->fetch_array($result)) {
      if (!empty($image_row['image_download_url'])) {
        if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
          $file_path = $image_row['image_download_url'];
          $file_name = basename($image_row['image_download_url']);
        }
      }
      elseif (is_remote($image_row['image_media_file'])) {
        $file_path = $image_row['image_media_file'];
        $file_name = basename($image_row['image_media_file']);
      }
      else {
        $file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
        $file_name = $image_row['image_media_file'];
      }

      if (!empty($file_path)) {
        @set_time_limit(120);
        if (!$file_data = get_file_data($file_path)) {
          continue;
        }
        $zipfile->add_file($file_data, $file_name);
        $file_added = 1;
        unset($file_data);
      }
    }

    if ($file_added) {
      @set_time_limit(120);
      $file['file_name'] = time().".zip";
      $file['file_data'] = $zipfile->file();
      $file['file_size'] = strlen($file['file_data']);
    }
    else {
      header("Location: ".$site_sess->url($url, "&"));
      exit;
    }
  }
}

3. Open /templates/yourtemplate/categories.html
3.1. Add {download_button} anywhere u want.


If u wish make it without limitation (download whole category) then u'll need change code:
Code: [Select]
       ORDER BY ".$config['image_order']." ".$config['image_sort']."
        LIMIT $offset, $perpage";
with this:
Code: [Select]
       ORDER BY ".$config['image_order']." ".$config['image_sort']."";
if u want limit downloaded pictures to your own desired number, change:
Code: [Select]
       LIMIT $offset, $perpage"; to this:
Code: [Select]
        LIMIT $offset, X"; where X is number u want.

167
Chit Chat / is there a way find out time from client computer?
« on: January 05, 2003, 05:46:23 PM »
I'm trying add some text that changes every specific pereoud of time and deppence on what hour it is.
if I use time() from php it will uses only server's time. and people visiting from other side of the world would get same thing that from other side...
right now I managed uses javascript to find a time, because it's client side script, but the script become very big, because I need send to client all text for each hour, and javascript shows only the one that is set for the curent time....
so, if atleast that could be acomplished:
in javascript first find what time it is:
DAY = new Date()
HR = day.getHours()
then execute some php code:
{time} or <?php include("time.php"); ?> that will display the text deppense on what is in " HR ".
so, I was wondering if there is a way php can find out what is curent time on client machine?
thx.

168
Discussion & Troubleshooting / random image question.
« on: January 04, 2003, 11:40:01 PM »
it seems that RANDOM_IMAGE and RANDOM_CAT_IMAGE shows same image:


yes, it does show different image if RANDOM_CAT_IMAGE picked an image from sub-category.
so if RANDOM_IMAGE chosed top level category to pick an image from and RANDOM_CAT_IMAGE chosed same top level category (not subcategory) then it  will show same image.
have anyone else notised it or I am just confused :? ?

169
I have succesfully add MSN, Yahoo and AIM fields in user info.
it shows everywhere, exept coments.
I did the same things as for other pages but still it doesnt show it.
all I could find that in details.php in coments code reads ICQ data from database
Code: [Select]
get_user_table_field(", u.", "user_icq"), but doesnt read " additional.sql " data that stores the rest (?)...
so, can someone help me to make details code read all fields from USER table?
thx.

170
Chit Chat / any php coders? ((;
« on: January 01, 2003, 11:18:32 AM »
Hi!
can someone help me out with this little task?
I cant figure out how those preg_match/preg_replace works...
if someone could help me a little bit...

when a user enter a URL " http://site.com/document.php?huh=0 "
I get part of that URL ( /document.php?huh=0 ) by " $REQUEST_URI; "
now I need check if there is already ?l= or &l= if not then add one at the end...
can someone help me plz? I'm trying fix the script with language chooser....
thx!

171
I'm trying add some {if ...}blah blah blah {endif ...} into teplate.
I thought it {if ...} checks if variable not empty  then it add the code...
but seems it works differently.
can someone explain how it actualy works? what do I need to do?
thx.

172
I'm trying add a link from menu to a new template. (statistic.php)
but I cant figure out how it can keep all the tags that come after "?" sign in the url?
for ex.
I changed language to russian and so, in the url it shows like this:
Quote
http://doman.com/category.php?cat_id=3&l=russian

all URLs that generated by php codes (links to images, user options so on) keeping "l=russian" tag, but the links from template r loosing it.
so, when I click on the link that point to ./statistic.php it will loose "l=russian" tag...
how can I make it keep "l=" tag?
thx.

173
Works with all 4images versions

This MOD will let in detail page by clicking on the image, open new fullscreen window with bigger size image (new window will be closed by clicking on mouse buttons).
NOTE:
1. This MOD doesnt resize or do anything with images, and u'll need upload "big/original" images manualy.
2. Because its open new window with no html code, it will show on top of the window FULL PATH to the image :( and if u use some download manager it may start downloading the image instead of showing it.
3. It works only with images, that doesnt requre media icons.
4. "Big/original" images filename must be the same as the image filename.
5. If u deleted picture from the site (as admin), "big/original" picture will stay there, u'll need delete it manualy.
6. There is no control by user permissions for viewing "big/original" images, means that the script will create a link to the popup window if it find "big/original" file for the picture.

INSTALLATION:
1. open /includes/functions.php file
1.1. find:
Code: [Select]
   $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH))."/".$file_name;
    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : $return_code;
Replace with:
Code: [Select]
   $path = (($image_type == "media") ? (($cat_id) ? MEDIA_PATH."/".$cat_id : MEDIA_TEMP_PATH) : (($image_type == "big") ? MEDIA_PATH."/".$cat_id."/big" : (($cat_id) ? THUMB_PATH."/".$cat_id : THUMB_TEMP_PATH)))."/".$file_name;
    return ($check_handle($file_name) && file_exists($path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is", $file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" : $path) : (($image_type != "big") ? $return_code : "");
1.2. Find:
Code: [Select]
   "image_file_name" => $image_row['image_media_file'],
Add after:
Code: [Select]
   "media_src_big" => get_media_code($image_row['image_media_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, $detailed_view, 1),
1.3. Find:
Code: [Select]
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0) {Replace with:
Code: [Select]
function get_media_code($media_file_name, $image_id = 0, $cat_id = 0, $image_name = "", $mode = "", $show_link = 0, $detailed_view = 0, $big = 0) {
1.4. Find:
Code: [Select]
   $media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);Add after:
Code: [Select]
   $media_src_big = get_file_path($media_file_name, "big", $cat_id, 0, 1);1.5. Find:
Code: [Select]
   $media = $site_template->parse_template("media/".$file_extension);Replace with:
Code: [Select]
   $media = ((!$big) ? ($site_template->parse_template("media/".$file_extension)) : $media_src_big);1.6. At the end of the file before
Code: [Select]
?>Add this:
Code: [Select]
function check_remote_big($remote_media_file) {
  global $config;
  return (preg_match("#^(https?:\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)*[a-z]+(:[0-9]+)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $remote_media_file)) ? 1 : 0;
}
function check_local_big($local_media_file) {
  global $config;
  return (preg_match("#^((\.)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $local_media_file)) ? 1 : 0;
}
function check_big_type($file_name) {
  global $config;
  return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}


2. Open details.html template
2.1 Find:
Code: [Select]
{image}Replace with:
Code: [Select]
{if media_src_big}
    <script type="text/javascript">function openpopupbig(big){var popurl="{media_src_big}";settings='location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes,dependent=no';winpopsbigWindow=window.open(popurl,big,settings);winpopsbigWindow.focus();}</script>                  
                  <a class="big" href="javascript:openpopupbig('big')">{endif media_src_big}
   {image}{if media_src_big}</a>{endif media_src_big}




3. Now, all u need is create a folder with name "big" in the category folder. For ex. if u have a picture with name proba.jpg in category number 29, u'll need locate that category folder /data/media/29, create folder "big", so in this example it would looks like this: /data/media/29/big and upload picture proba.jpg. Upload "big/original" images in that folder with same filename.

174
for some reason sub categories (when opens categories.php) dont show in even columns...check this pic

can I fix it some how?
thx.

P.S. there is nothing wrong with template, something goes wrong in the code...

175
if u use this function in category_bit.html template (already there, need just uncoment it)
Code: [Select]
      {if random_cat_image_file}<a href="{cat_url}"><img src="{random_cat_image_file}" width="{width_limited50}" height="{height_limited50}" border="1"></a>{endif random_cat_image_file}

it will show 404 picture if thumnbnail is media image...

while I was writing this, I figured where is the problem. here is the fix for it:
in /includes/functions.php file search for:
Code: [Select]
     return get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $category_id, 0, 1);
change to this:
Code: [Select]
    if (!get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($random_image_cache[$category_id]['image_media_file']).".gif";
    }
    else {
      $file_src = get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb", $cat_id, 0, 1);

   }
      return $file_src;
should work now.  :wink:  :D

176
-sample command create terrible quality pictures. Why u dont use -geometry command? first off all the quality with that command is exelent, and second, file size become smaller.

177
I would like show FLASH files with size not larger then 800x800. so, when I change /templates/media/swf.html temlate with width="800" height="800" instead of {width_height}, then it's displays exactly 800x800 and if FLASH file originaly 200x100 ti will have white canvas on top and bottom. so, my question is, where I can add something that can resize proportionly FLASH files? to keep them original size if the size smaller or equal 800x800, or make it smaller to that size?
hope that's can be done.

[EDITED]
I figured how to do that. but now I have another question:
what is the math formula to resize rectangle proportionaly?  :roll:

178
Installation, Update & Configuration / In what sequence loads templates?
« on: November 23, 2002, 11:06:12 AM »
I'm trying implant a script that shows how much time the page was rendred. so, I need to know witch template loads first and last.
I thought header.html is first and footer.html is last, but now I doubt couse it shows about the same time in the category with lots of pictures (random picture slowing the rendering almost twice) and little category.

179
I was trying do this way so users would receive emails from admin that shows the name I put, in "From: ", not email address.
yes, it works, but in field "To: " users receive " > " nothing else. instead of that was supposed to be his (user's) email(?)...or mybe admin's email(?).

P.S. I'm using SMTP for sending emails.

180
I installed statistic on my server and add logging script to header.html file. everything works fine, but then I noticed the pageimpressions counts twice when I click on thumbnail to open detail page.
when I do refresh it counts ones, only when open new picture detail it counts twice (actualy its not just detail page, but any clicks counts as two clicks)
so, I'm wondering how come header.html file calls twice on each click?

Pages: 1 ... 8 9 10 11 [12] 13 14