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 - batu544

Pages: 1 2 [3] 4
31
Discussion & Troubleshooting / Emails in html format
« on: September 27, 2009, 12:32:55 PM »
Hi,
    I have developed a news letter kind of script to send latest 9 images to all the users from ACP. So, I need to change the email format from text to html. I have added two lines in email.php file to achieve this.

Code: [Select]
$header .= 'MIME-Version: 1.0' . "\r\n";
$header .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

Everything is working fine now.. But now the problem is the mails are NOT going to users inbox. All the mails are being treated as SPAM by yahoo and hotmail.


Can anyone please let  me know what mistake I have done or do I need to add anything extra to fix this issue ?

 



32
Installation, Update & Configuration / Website not working ..
« on: September 11, 2009, 06:09:37 AM »
Hi All -
           Recently my website hosting company has done some changes and for this reason my main page is not working.. I am getting following error..

Code: [Select]

Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

Fatal error: Unknown: Failed opening required '/home/bhwallpa/public_html/index.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in Unknown on line 0


any idea how to fix this ?? Do I need to change any settings in 4image ?

Thanks,
batu544

33
Hi All -
           No idea how efficient this code .. but here is the process for sending automatic mails when admin uploads an image. Please note this upload is not from ACP. Admin needs to upload the images from the website like other users..

You may take the backup of the file before doing the changes .. :)

Step 1 :

Open member.php   and insert below these lines ..

Code: [Select]
      if ($config['upload_notify'] == 1 && !$direct_upload) {
        include(ROOT_PATH.'includes/email.php');
        $site_email = new Email();

        $config['upload_emails'] = str_replace(" ", "", $config['upload_emails']);
        $emails = explode(",", $config['upload_emails']);

        $validation_url = $script_url."/admin/index.php?goto=".urlencode("validateimages.php?action=validateimages");

        $site_email->set_to($config['site_email']);
        $site_email->set_subject($lang['new_upload_emailsubject']);
        $site_email->register_vars(array(
          "image_name" => stripslashes($image_name),
          "file_name" => $new_name,
          "cat_name" => $cat_cache[$cat_id]['cat_name'],
          "validation_url" => $validation_url,
          "site_name" => $config['site_name']
        ));
        $site_email->set_body("upload_notify", $config['language_dir_default']);
        $site_email->set_bcc($emails);
        $site_email->send_email();
      }

New code :

Code: [Select]
// -------------------------------------------------------------------------------------
//  SEND EMAIL TO ALL THE USERS
// -------------------------------------------------------------------------------------
if ($user_info['user_level']  == ADMIN ) {
  $sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_level").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email")."
          FROM ".USERS_TABLE."
          WHERE ".get_user_table_field("", "user_id")." <> ".GUEST." AND ".get_user_table_field("", "user_allowemails")." = 1
          ORDER BY ".get_user_table_field("", "user_level")." DESC";

  $result = $site_db->query($sql);
    @set_time_limit(1200);
        include(ROOT_PATH.'includes/email.php');
    while ($row = $site_db->fetch_array($result)) {
    $user_email = $row[$user_table_fields['user_email']];
        $site_email = new Email();
        $validation_url = $script_url."/details.php?image_id=".$image_id;
        $site_email->set_to($user_email);
        $site_email->register_vars(array(
          "image_name" => stripslashes($image_name),
          "file_name" => $new_name,
          "cat_name" => $cat_cache[$cat_id]['cat_name'],
          "validation_url" => $validation_url,
          "site_name" => $config['site_name']
        ));
$site_email->set_subject($lang['new_upload_emailsubject']);
        $site_email->set_body("upload_not", $config['language_dir_default']);
        $site_email->send_email();
      }
  }
//------------------------------- CODE ENDS HERE ---------------------------------



Step 2:
   
     Create a new file called upload_not.html   and place it in \lang\english\email folder and put what message you want to send to all the users. ( I just copied the details from upload_notify.html file with little modification :)  )


Thants it.. now Enjoy !!!   :)

34
Chit Chat / WhoIS online ?/
« on: August 13, 2009, 03:39:09 PM »
Hi,
       I think it may be outside the 4image question.. but here is the question .. For last couple of days .. I can see in my ACP WhoIS online list .. there is a guest who is accessing one particular image from 2-3 different IPs ( as per the Flag MOD, the user's location is Germany )  and for this reason the image Hit count also increased ..

Is there any way.. I can know how my webpage has been accessed by that user.. ??

Thanks,
batu



35
Discussion & Troubleshooting / Latest photo download display...
« on: July 16, 2009, 11:44:57 PM »
Hi All,
           Is there any way to show the latest 5 downloaded images in home.html page ?

 Thanks,
batu544

36
Discussion & Troubleshooting / Check new Image...
« on: July 04, 2009, 09:32:25 AM »
Hi All -
             I have been using the following checkimages.php file for adding new images for a long time and there is no problem it it.. But now I want to add the description field also as input while adding the images.The description field should be populated from the image name.  I have done some changes and now the Description: field is displaying and populating the field also. But  it is NOT updated in the database. Could anyone look into this and let me know what other changes I need to do..


Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: checkimages.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7                                                  *
 *    File version: 2.11                                                  *
 *                                                                        *
 *    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.                              *
 *                                                                        *
 *************************************************************************/

define('IN_CP'1);
define('ROOT_PATH''./../');
if (isset(
$_GET['action']) && $_GET['action'] == "showthumb" && isset($_GET['mode']) && $_GET['mode'])
  
$no_zip 1;
require(
'admin_global.php');

//--------| Default Settings |-------------

$quality_default = (isset($config['auto_image_quality']) && $config['auto_image_quality']) ? $config['auto_image_quality'] : 85//image quality
$quality_thumbs_default $config['auto_thumbnail_quality']; //thumbnail quality
$dimension_default $config['max_image_width']; //image dimension
$dimension_thumbs_default $config['auto_thumbnail_dimension']; //thumbnail demension
$max_dimension_default 600//displayed in preview image dimension (not image resizing)
$num_newimages_default 30//images per circle
$big_folder_default "big"//name of the "big" folder where original image will be copied to, if its bigger then size set in the settings.
$big_annotate 0//add annotation to the "original" images in "big" folder? (0 or 1)
$backup_orig ""//leave empty if u dont want backup files when it needed resize or add watermark (to preserve IPTC and EXIF headers) NO TRAILING SLASH!
$filter 1//use a filter on filenames. Any non-standart characters will be replaced with _ or just be deleted. (0 or 1)
$thumbpreview 1//create temporary thumbnails for preview if no original was found. (only for none-detailed view) (0 or 1)
$thumbpreview_quality 70//quality for temporary thumbnails
$thumbpreview_dimensions 50//max dimensions for temporary thumbnails
$thumbpreview_tempdir ROOT_PATH.'data/temp'//directory for temporary files. Must be writable (CHMOD 777).
$rescan 1//rescan for new images after first portion of images added (0 or 1)
if (!$mode)
{
  
$annotate_default = (isset($config['annotation_use'])) ? $config['annotation_use'] : 0//add annotation to the images (require "Annotation MOD" by SLL)
  
$big_default 0//save original image (0 or 1)
  
$iptc_date_default 0//auto insert date from IPTC (0 or 1)
  
$iptc_keywords_default 0//auto insert keyword from IPTC (0 or 1)
  
$iptc_description_default 0//auto insert captions from IPTC (0 or 1)
  
$iptc_name_default 0//auto insert name from IPTC (0 or 1)
  
$detailed_default 0//detailed view (0 or 1)
  
$auto_resize_default 1//resize images (0 or 1)
  
$auto_thumbs_default 1//create thumbs (0 or 1)
  
$subcats_default 0//include subcategories (0 or 1)
}

//----------| End Settings |---------------

//----------| Language |------------
//you can move these into lang/<your language>/admin.php

$lang['cni_max_dim'] = "Max dimensions for images preview<br /><span class=\"smalltext\">When checked \"Detailed\", image will be resized on your screen acording this value.</span>";
$lang['cni_iptc_name'] = "Use name from IPTC value";
$lang['cni_iptc_description'] = "Use description from IPTC value";
$lang['cni_iptc_keywords'] = "Use keywords from IPTC value";
$lang['cni_iptc_date'] = "Use date from IPTC value";
$lang['cni_check_subcat'] = "Check subcategories";

$lang['cni_auto_resizer'] = "Auto resizer";
$lang['cni_save_orig'] = "Save original images";
$lang['cni_big_folder'] = "Folder name where to save original images";
$lang['cni_add_ann'] = "Add annotation (watermark)";
$lang['cni_auto_thumbnailer'] = "Auto thumbnailer";
$lang['cni_foundin'] = "Found in";
$lang['cni_root_folder'] = "root folder";
$lang['on'] = "On";
$lang['off'] = "Off";

//logs
$lang['cni_media_file_rename'] = "Media file renamed from <b>{from}</b> to <b>{to}</b>";
$lang['cni_media_file_rename_error'] = "<u>Error</u> renaming media file from <b>{from}</b> to <b>{to}</b>";
$lang['cni_thumb_file_rename'] = "Thumbnail file renamed from <b>{from}</b> to <b>{to}</b>";
$lang['cni_thumb_file_rename_error'] = "<u>Error</u> renaming thumbnail file from <b>{from}</b> to <b>{to}</b>";
$lang['cni_copy_success'] = "Copied file into <b>{name}</b> folder.";
$lang['cni_copy_thumb_success'] = "Copied thumbnail into <b>{name}</b> folder.";
$lang['cni_backup_success'] = "Backup original file into <b>{name}</b> folder.";
$lang['cni_backup_error'] = "<u>Error</u> copying original file into <b>{name}</b> folder.";
$lang['cni_annotation_success'] = "Added annotation in <b>{name}</b> file.";
$lang['cni_annotation_error'] = "<u>Error</u> adding annotation in <b>{name}</b> file.";
$lang['cni_create_folder_success'] = "Created <b>{name}/</b> folder.";
$lang['cni_create_folder_error'] = "<u>Error</u> creating <b>{name}/</b> folder.";

//----------| End Language |-----------

if ($action == "showthumb" && $mode)
{
  
$result true;
  if (!@
is_dir($thumbpreview_tempdir))
  {
    
$oldumask umask(0);
    
$result mkdir($thumbpreview_tempdir);
    
umask($oldumask);
    if (!@
is_dir($thumbpreview_tempdir) || !$result)
    {
      
$result mkdir($thumbpreview_tempdir0755);
    }
  }

  require(
ROOT_PATH.'includes/image_utils.php');
$convert_options init_convert_options();
  
$thumb ICON_PATH."/404.gif";
  
$file MEDIA_PATH."/".(($cat_id) ? $cat_id ."/" "").$mode;
  
$delete false;
  if (!
$convert_options['convert_error'] && $result && $img = @getimagesize($file))
  {
    if (
$img[2] >= && $img[2] < 4)
    {
      
$thumb $file;
    }
    else
    {
      
$thumb ICON_PATH."/".strtolower(substr(strrchr($mode,"."), 1)).".gif";
    }
}
  else
  {
    
$thumb ICON_PATH."/".strtolower(substr(strrchr($mode,"."), 1)).".gif";
  }
if (!$convert_options['convert_error'])
  {
  
$file $thumbpreview_tempdir."/".MD5(time().microtime());
  
$type substr(strrchr($thumb,"."), 1);
    if (
create_thumbnail($thumb$file$thumbpreview_quality$thumbpreview_dimensions1))
    {
      
$delete true;
      
$thumb $file;
    }
}
  
header("Content-Type: image/".$type);
  
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");             // turn off caching
  
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
  
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  @
readfile($thumb);
  if (
$delete)
  {
    @
unlink($file);
  }
  exit;
}

include(
ROOT_PATH.'includes/search_utils.php');

function 
backup($src$dest$name$cat_id)
{
  
$dest .= "/".$cat_id;
  
$result true;
  if (!@
is_dir($dest))
  {
    
$oldumask umask(0);
    
$result mkdir($dest);
    
umask($oldumask);
    if (!@
is_dir($dest) || !$result)
    {
      
$result mkdir($dest0755);
    }
  }
  if (
$result)
  {
    return 
copy($src$dest."/".$name);
  }
  return 
false;
}
function 
get_subcats($cat_id 0$cid 0) {
  global 
$sub_cat_cache$cat_cache$cats;

  if (!isset(
$sub_cat_cache[$cid])) {
    return 
"";
  }
  foreach (
$sub_cat_cache[$cid] as $key => $category_id) {
    
$cats[] = $category_id;
    
get_subcats($cat_id$category_id);
  }
  unset(
$sub_cat_cache[$cid]);
}

if (
$action == "")
{
  
$action "checkimages";
}
$status 0;

function 
get_category_dropdown_check($cat_id 0)
{
  global 
$lang$drop_down_cat_cache$cat_parent_cache;
    
$category "\n<select name=\"cat_id_p\" class=\"categoryselect\">\n";
    
$category .= "<option value=\"0\">".$lang['all_categories']."</option>\n";
    
$category .= "<option value=\"0\">-------------------------------</option>\n";

  
$drop_down_cat_cache = array();
  
$drop_down_cat_cache $cat_parent_cache;
  
$category .= get_category_dropdown_bits($cat_id);
  
$category .= "</select>\n";
  return 
$category;
}
show_admin_header();

if (
$action == "savenewimages")
{
  @include(
ROOT_PATH."includes/db_field_definitions.php");

  
$date time();
  
$error = array();
  
$num_newimages $HTTP_POST_VARS['num_newimages'];
  
$detailed $HTTP_POST_VARS['detailed'];
  
$auto_resize = (isset($HTTP_POST_VARS['auto_resize']) && $HTTP_POST_VARS['auto_resize'] == 1) ? 0;
  
$auto_thumbs = (isset($HTTP_POST_VARS['auto_thumbs']) && $HTTP_POST_VARS['auto_thumbs'] == 1) ? 0;
  
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : $dimension_default;
  
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : 1;
  
$quality = (isset($HTTP_POST_VARS['quality']) && intval($HTTP_POST_VARS['quality']) && intval($HTTP_POST_VARS['quality']) <= 100) ? intval($HTTP_POST_VARS['quality']) : $quality_default;
  
$dimension_thumbs = (isset($HTTP_POST_VARS['dimension_thumbs'])) ? intval($HTTP_POST_VARS['dimension_thumbs']) : $dimension_thumbs_default;
  
$resize_type_thumbs = (isset($HTTP_POST_VARS['resize_type_thumbs'])) ? intval($HTTP_POST_VARS['resize_type_thumbs']) : 1;
  
$quality_thumbs = (isset($HTTP_POST_VARS['quality_thumbs']) && intval($HTTP_POST_VARS['quality_thumbs']) && intval($HTTP_POST_VARS['quality_thumbs']) <= 100) ? intval($HTTP_POST_VARS['quality_thumbs']) : $quality_thumbs_default;
  
$big = (isset($HTTP_POST_VARS['big']) && $HTTP_POST_VARS['big'] == 1) ? $big_default;
  
$annotate = (isset($HTTP_POST_VARS['annotate']) && $HTTP_POST_VARS['annotate'] == 1) ? $annotate_default;
  
$big_folder = (isset($HTTP_POST_VARS['big_folder'])) ? trim($HTTP_POST_VARS['big_folder']) : $big_folder_default;
  for (
$i 1$i <= $num_newimages$i++)
  {
    
$addimage = (isset($HTTP_POST_VARS['addimage_'.$i]) && $HTTP_POST_VARS['addimage_'.$i] == 1) ? 0;
    if (
$addimage)
    {
      
$image_name trim($HTTP_POST_VARS['image_name_'.$i]);
      
$cat_id intval($HTTP_POST_VARS['cat_id_'.$i]);
      
$image_download_url = (isset($HTTP_POST_VARS['image_download_url_'.$i])) ? trim($HTTP_POST_VARS['image_download_url_'.$i]) : "";

      if (
$image_name == "")
      {
        
$error['image_name_'.$i] = 1;
      }
      if (
$cat_id == 0)
      {
        
$error['cat_id_'.$i] = 1;
      }
      if (
$image_download_url != "" && !is_remote($image_download_url) && !is_local_file($image_download_url))
      {
        
$error['image_download_url_'.$i] = 1;
      }

      if (!empty(
$additional_image_fields))
      {
        foreach (
$additional_image_fields as $key => $val)
        {
          if (isset(
$HTTP_POST_VARS[$key.'_'.$i]) && intval($val[2]) == && trim($HTTP_POST_VARS[$key.'_'.$i]) == "")
          {
            
$error[$key.'_'.$i] = 1;
          }
        }
      }
    }
  }
  if (empty(
$error))
  {
require(ROOT_PATH.'includes/image_utils.php');
$no_resize 0;
$convert_options init_convert_options();
if ($convert_options['convert_error'])
    {
$no_resize 1;
}
    
show_table_header($lang['nav_images_check']." log"1);
    echo 
"<tr>\n<td class=\"tablerow\">\n";
    echo 
"<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\"><tr><td>&nbsp;</td><td>\n";
    
$n 0;
    for (
$i 1$i <= $num_newimages$i++)
    {
      
$log = array();
      
$backup false;
      
$addimage = (isset($HTTP_POST_VARS['addimage_'.$i]) && $HTTP_POST_VARS['addimage_'.$i] == 1) ? 0;
      if (
$addimage)
      {
        
$image_media_file trim($HTTP_POST_VARS['image_media_file_'.$i]);
        
$image_thumb_file trim($HTTP_POST_VARS['image_thumb_file_'.$i]);
        
$image_name trim($HTTP_POST_VARS['image_name_'.$i]);

        
$cat_id intval($HTTP_POST_VARS['cat_id_'.$i]);
        
$old_cat_id intval($HTTP_POST_VARS['old_cat_id_'.$i]);

        
$user_id = (isset($HTTP_POST_VARS['user_id_'.$i]) && intval($HTTP_POST_VARS['user_id_'.$i]) != 0) ? intval($HTTP_POST_VARS['user_id_'.$i]) : "";
        
$user_id = ($user_id) ? $user_id : ((isset($HTTP_POST_VARS['user_id']) && intval($HTTP_POST_VARS['user_id']) != 0) ? intval($HTTP_POST_VARS['user_id']) : $user_info['user_id']);

        
$image_description = (isset($HTTP_POST_VARS['image_description_'.$i])) ? trim($HTTP_POST_VARS['image_description_'.$i]) : "";
        
$image_date = (isset($HTTP_POST_VARS['image_date_'.$i])) ? ((trim($HTTP_POST_VARS['image_date_'.$i] != "")) ? "UNIX_TIMESTAMP('".trim($HTTP_POST_VARS['image_date_'.$i])."')" time()) : time();
        
$image_download_url = (isset($HTTP_POST_VARS['image_download_url_'.$i])) ? trim($HTTP_POST_VARS['image_download_url_'.$i]) : "";

        if (isset(
$HTTP_POST_VARS['image_keywords_'.$i]))
        {
          
$image_keywords trim($HTTP_POST_VARS['image_keywords_'.$i]);
          
$image_keywords preg_replace("/[\n\r]/is"" "$image_keywords);
          
$image_keywords str_replace(","," ",$image_keywords);
          
$image_keywords ereg_replace("( ){2,}"" "$image_keywords);
        }
        else
        {
          
$image_keywords "";
        }

If ($image_description ' ')
{
$image_description "Sexy $image_name  wallpapers, $cat_name gallery pictures, images, photo albums";
            
$image_keywords "Sexy $image_name wallpapers pictures gallery album Hollywood bollywood celebrity hot wallpapers";
}

        
$image_active intval($HTTP_POST_VARS['image_active_'.$i]);
        
$image_allow_comments intval($HTTP_POST_VARS['image_allow_comments_'.$i]);

        
$additional_field_sql "";
        
$additional_value_sql "";
        if (!empty(
$additional_image_fields))
        {
          
$table_fields $site_db->get_table_fields(IMAGES_TABLE);
          foreach (
$additional_image_fields as $key => $val)
          {
            if (isset(
$HTTP_POST_VARS[$key.'_'.$i]) && isset($table_fields[$key]))
            {
              
$additional_field_sql .= ", $key";
              
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key.'_'.$i]))."'";
            }
          }
        }

        
$log[] = "Working on <b>".MEDIA_DIR.(($old_cat_id != 0) ? "/".$old_cat_id "")."/".stripslashes($image_media_file)."</b> file:";
        if (
$filter && preg_match("/( |%20|[^-\._a-zA-Z0-9])/"stripslashes($image_media_file)))
        {
          
$image_media_file_backup $image_media_file;
          
$image_media_file stripslashes($image_media_file);
          
$file str_replace(" ""_"$image_media_file);
          
$file str_replace("%20""_"$file);
          
$file preg_replace("/[^-\._a-zA-Z0-9]/"""$file);
          
$oldwd getcwd();
          
$n 2;
          
$copy "";
          
$file_name substr($file,0,(strlen($file)-strlen(strrchr($file,"."))));
          
$file_ext substr(strrchr($file,"."), 1);
          
chdir(realpath(MEDIA_PATH.(($old_cat_id != 0) ? "/".$old_cat_id "")));
          while (
file_exists($file_name.$copy.".".$file_ext)) {
            
$copy "_".$n;
            
$n++;
          }
          
$file $file_name.$copy.".".$file_ext;
          if (
rename(basename($image_media_file), basename($file)))
          {
            
$log[] = str_replace("{from}"$image_media_filestr_replace("{to}"$file$lang['cni_media_file_rename']));
            
$image_media_file $file;
          }
          else
          {
            
$log[] = str_replace("{from}"$image_media_filestr_replace("{to}"$file$lang['cni_media_file_rename_error']));
            
$image_media_file $image_media_file_backup;
          }
          
chdir($oldwd);
        }
        if (
$filter && preg_match("/( |%20|[^-\._a-zA-Z0-9])/"stripslashes($image_thumb_file)))
        {
          
$image_thumb_file_backup $image_thumb_file;
          
$image_thumb_file stripslashes($image_thumb_file);

          
$file str_replace(" ""_"$image_thumb_file);
          
$file str_replace("%20""_"$file);
          
$file preg_replace("/[^-\._a-zA-Z0-9]/"""$file);
          
$oldwd getcwd();
          
$n 2;
          
$copy "";
          
$file_name substr($file,0,(strlen($file)-strlen(strrchr($file,"."))));
          
$file_ext substr(strrchr($file,"."), 1);
          
chdir(realpath(THUMB_PATH.(($old_cat_id != 0) ? "/".$old_cat_id "")));
          while (
file_exists($file_name.$copy.".".$file_ext)) {
            
$copy "_".$n;
            
$n++;
          }
          
$file $file_name.$copy.".".$file_ext;
          if (
rename(basename($image_thumb_file), basename($file)))
          {
            
$log[] = str_replace("{from}"$image_thumb_filestr_replace("{to}"$file$lang['cni_thumb_file_rename']));
            
$image_thumb_file $file;
          }
          else
          {
            
$log[] = str_replace("{from}"$image_thumb_filestr_replace("{to}"$file$lang['cni_thumb_file_rename_error']));
            
$image_thumb_file $image_thumb_file_backup;
          }
          
chdir($oldwd);
        }
        if (
$cat_id != $old_cat_id)
        {
          
$image_media_file copy_media($image_media_file$old_cat_id$cat_id);
          if (
file_exists(MEDIA_PATH.(($old_cat_id != 0) ? "/".$old_cat_id "")."/".$image_media_file))
          {
            
$log[] = str_replace("{name}"MEDIA_DIR.(($cat_id != 0) ? "/".$cat_id ""), $lang['cni_copy_success']);
          }
          
$image_thumb_file copy_thumbnail($image_media_file$image_thumb_file$old_cat_id$cat_id);
          if (
file_exists(THUMB_PATH.(($old_cat_id != 0) ? "/".$old_cat_id "")."/".$image_thumb_file))
          {
            
$log[] = str_replace("{name}"THUMB_DIR.(($cat_id != 0) ? "/".$cat_id ""), $lang['cni_copy_success']);
          }
        }
$file MEDIA_PATH.(($cat_id != 0) ? "/".$cat_id "")."/".$image_media_file;
if ($big)
        {
  $big_file MEDIA_PATH."/".$cat_id."/".$big_folder."/".$image_media_file;
          if (
file_exists($big_file))
          {
    
if ($big_annotate && $annotate && ($image_info getimagesize($big_file)) && $image_info[2] > && $image_info[2] < 4)
    
{
              if (
$backup_orig)
              {
            
if ($backup backup($big_file$backup_orig$image_media_file$cat_id))
            
{
$log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_backup_success']);
}
else
{
$log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_backup_error']);
}
            
}
    
  include_once(ROOT_PATH.'includes/annotate.php');
              if (
function_exists("annotate_image") && annotate_image($big_file))
    
  {
  $log[] = str_replace("{name}"MEDIA_DIR."/".$cat_id."/".$big_folder."/".stripslashes($image_media_file), $lang['cni_annotation_success']);
    
  }
    
  else
    
  {
  $log[] = str_replace("{name}"MEDIA_DIR."/".$cat_id."/".$big_folder."/".stripslashes($image_media_file), $lang['cni_annotation_error']);
    
  }
    
}
}
}
      if ($auto_resize && file_exists($file) && !$no_resize)
        {
        if ($image_info getimagesize($file))
          {
        if ($image_info[2] == || $image_info[2] == || $image_info[2] == 3)
            {
          $ok 0;
          if ($resize_type == && ($image_info[0] > $dimension || $image_info[1] > $dimension))
              {
            $ok 1;
          }
          elseif ($resize_type == && $image_info[0] > $dimension)
              {
            $ok 1;
          }
          elseif ($resize_type == && $image_info[1] > $dimension)
              {
            $ok 1;
          }
if ($ok)
              {
                if (
$backup_orig && !$backup)
                {
              
if ($backup backup($file$backup_orig$image_media_file$cat_id))
              
{
  $log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_backup_success']);
 
}
else
{
  
$log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_backup_error']);
}
              
}
if ($big)
                {
  $src MEDIA_PATH."/".$cat_id."/".$big_folder;
$result true;
  if (!@is_dir($src))
                  {
    $oldumask umask(0);
    $result mkdir($src);
    umask($oldumask);
    if (!@is_dir($src) || !$result)
                    {
      $result mkdir($src0755);

    }
                    if (
$result)
                    {
    $log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_create_folder_success']);
                    }
                    else
                    {
 
    $log[] = str_replace("{name}"$backup_orig."/".$cat_id$lang['cni_create_folder_error']);
                   }
  }
if ($result == true){
  $big_file $src."/".$image_media_file;
if (copy($file$big_file))
{
  $log[] = "Copied original file into <b>".MEDIA_DIR."/".$cat_id."/".$big_folder."/</b> folder.";
  $image_info getimagesize($big_file);
              
if ($big_annotate && $annotate && $image_info && $image_info[2] > && $image_info[2] < 4)
              
{
              
  include_once(ROOT_PATH.'includes/annotate.php');
              
  if (function_exists("annotate_image") && annotate_image($big_file))
              
  {
              
    $log[] = "Added annotation in <b>".MEDIA_DIR."/".$cat_id."/".$big_folder."/".stripslashes($image_media_file)."</b> file.";
              
  }
              
  else
              
  {
              
    $log[] = "<u>Error</u> adding annotation in <b>".MEDIA_DIR."/".$cat_id."/".$big_folder."/".stripslashes($image_media_file)."</b> file.";
              
  }
              
}
}
else
{
  $log[] = "<u>Error</u> copying original file into <b>".MEDIA_DIR."/".$cat_id."/".$big_folder."/</b> folder.";
}
}
}
        if (resize_image($file$quality$dimension$resize_type))
                {
          $log[] = "Image resized.";
        }
        else
                {
           $log[] = "<u>Error</u> resizing image.";
        }
}
        }
      }
    }
$file MEDIA_PATH."/".$cat_id."/".stripslashes($image_media_file);
$image_info getimagesize($file);
if ($annotate && $image_info && $image_info[2] > && $image_info[2] < 4)
{
          if (
$backup_orig && !$backup)
          {
        
if ($backup backup($file$backup_orig$image_media_file$cat_id))
        
{
$log[] = "Backup original file into <b>".$backup_orig."/".$cat_id."/</b> folder.";
}
else
{
  $log[] = "<u>Error</u> copying original file into <b>".$backup_orig."/".$cat_id."/</b> folder.";
}
        
}
  include_once(ROOT_PATH.'includes/annotate.php');
  if (function_exists("annotate_image") && annotate_image($file))
  {
    $log[] = "Added annotation in <b>".MEDIA_DIR."/".$cat_id."/".stripslashes($image_media_file)."</b> file.";
  }
  else
  {
    $log[] = "<u>Error</u> adding annotation in <b>".MEDIA_DIR."/".$cat_id."/".stripslashes($image_media_file)."</b> file.";
  }
}
$file_thumb THUMB_PATH."/".$cat_id."/".stripslashes($image_media_file);
      if ($image_info && $image_info[2] > && $image_info[2] < && $auto_thumbs && $image_thumb_file == "" && file_exists($file) && !$no_resize && !file_exists($file_thumb))
        {
          
$ok 0;
          if (
$resize_type_thumbs == && ($image_info[0] > $dimension_thumbs || $image_info[1] > $dimension_thumbs))
          {
            
$ok 1;
          }
          elseif (
$resize_type_thumbs == && $image_info[0] > $dimension_thumbs)
          {
            
$ok 1;
          }
          elseif (
$resize_type_thumbs == && $image_info[1] > $dimension_thumbs)
          {
            
$ok 1;
          }
if ($ok)
          {
      
if (create_thumbnail($file, $file_thumb$quality_thumbs$dimension_thumbs$resize_type_thumbs))
            {
          $log[] = "Created thumbnail.";
          $image_thumb_file $image_media_file;
        }
        else
            {
        
$log[] = "<u>Error</u> creating thumbnail.";
        }
}
    }
        
$sql "INSERT INTO ".IMAGES_TABLE."
                (cat_id, user_id, image_name, image_description, image_keywords, image_date, image_active, image_media_file, image_thumb_file, image_download_url, image_allow_comments"
.$additional_field_sql.")
                VALUES
                (
$cat_id$user_id, '$image_name', '$image_description', '$image_keywords', $image_date$image_active, '$image_media_file', '$image_thumb_file', '$image_download_url', $image_allow_comments".$additional_value_sql.")";
        
$result $site_db->query($sql);
        
$image_id $site_db->get_insert_id();

        if (
$result)
        {
          
$search_words = array();
          foreach (
$search_match_fields as $image_column => $match_column)
          {
            if (isset(
$HTTP_POST_VARS[$image_column.'_'.$i]))
            {
              
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column.'_'.$i]);
            }
          }
          
add_searchwords($image_id$search_words);
          
$log[] = $lang['image_add_success'].": <b><a target=\"4images\" href=\"../details.php?image_id=".$image_id."\">".stripslashes($image_name)."</a></b>";
//ensure that rescaned images wont get same info as already added ones.
          
$n++;
        }
        else
        {
          
$log[] = "<u>Error</u> adding image!";
        }
        
$log[] = "";
        unset(
$HTTP_POST_VARS['image_name_'.$i]);
        unset(
$HTTP_POST_VARS['image_media_file_'.$i]);
        unset(
$HTTP_POST_VARS['image_thumb_file_'.$i]);
        unset(
$HTTP_POST_VARS['image_name_'.$i]);
        unset(
$HTTP_POST_VARS['cat_id_'.$i]);
        unset(
$HTTP_POST_VARS['old_cat_id_'.$i]);
        unset(
$HTTP_POST_VARS['user_id_'.$i]);
        unset(
$HTTP_POST_VARS['image_description_'.$i]);
        unset(
$HTTP_POST_VARS['image_date_'.$i]);
        unset(
$HTTP_POST_VARS['image_download_url_'.$i]);
        unset(
$HTTP_POST_VARS['image_keywords_'.$i]);
        unset(
$HTTP_POST_VARS['image_active_'.$i]);
        unset(
$HTTP_POST_VARS['image_allow_comments_'.$i]);
        unset(
$error['image_name_'.$i]);
        unset(
$error['image_media_file_'.$i]);
        unset(
$error['image_thumb_file_'.$i]);
        unset(
$error['image_name_'.$i]);
        unset(
$error['cat_id_'.$i]);
        unset(
$error['old_cat_id_'.$i]);
        unset(
$error['user_id_'.$i]);
        unset(
$error['image_description_'.$i]);
        unset(
$error['image_date_'.$i]);
        unset(
$error['image_download_url_'.$i]);
        unset(
$error['image_keywords_'.$i]);
        unset(
$error['image_active_'.$i]);
        unset(
$error['image_allow_comments_'.$i]);
        if (!empty(
$additional_image_fields))
        {
          foreach (
$additional_image_fields as $key => $val)
          {
            unset(
$HTTP_POST_VARS[$key.'_'.$i]);
            unset(
$error[$key.'_'.$i]);
          }
        }
      }
      if (
count($log))
      {
        foreach (
$log as $val)
        {
          echo 
$val."<br />";
        }
      }
    }
    if (!
$n)
    {
      echo 
$lang['no_newimages_added'];
    }
    echo 
"</td>\n</tr>\n</table>\n";
    echo 
"</td>\n</tr>\n";
    
show_table_footer();
    
$status 1;
    
$action "checkimages";
  }
  else
  {
    
$msg sprintf("<span class=\"marktext\">%s</span>"$lang['lostfield_error']);
    
$action "checkimages";
  }
  if (!
$rescan)
  {
    unset(
$HTTP_POST_VARS['action']);
  }
}

if (
$action == "checkimages")
{
  
$max_dimension = (isset($HTTP_POST_VARS['max_dimension'])) ? $HTTP_POST_VARS['max_dimension'] : $max_dimension_default;
  
$cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : 0;
  
$num_newimages = (isset($HTTP_POST_VARS['num_newimages'])) ? intval($HTTP_POST_VARS['num_newimages']) : $num_newimages_default;
  
$detailed = (isset($HTTP_POST_VARS['detailed'])) ? intval($HTTP_POST_VARS['detailed']) : $detailed_default;
  
$detailed_checked = ($detailed == 1) ? " checked=\"checked\"" "";
  
$auto_resize = (isset($HTTP_POST_VARS['auto_resize'])) ? intval($HTTP_POST_VARS['auto_resize']) : $auto_resize_default;
  
$auto_resize_checked = ($auto_resize == 1) ? " checked=\"checked\"" "";
  
$auto_thumbs = (isset($HTTP_POST_VARS['auto_thumbs'])) ? intval($HTTP_POST_VARS['auto_thumbs']) : $auto_thumbs_default;
  
$auto_thumbs_checked = ($auto_thumbs == 1) ? " checked=\"checked\"" "";
  
$iptc_date = (isset($HTTP_POST_VARS['iptc_date'])) ? intval($HTTP_POST_VARS['iptc_date']) : $iptc_date_default;
  
$iptc_description = (isset($HTTP_POST_VARS['iptc_description'])) ? intval($HTTP_POST_VARS['iptc_description']) : $iptc_description_default;
  
$iptc_keywords = (isset($HTTP_POST_VARS['iptc_keywords'])) ? intval($HTTP_POST_VARS['iptc_keywords']) : $iptc_keywords_default;
  
$iptc_name = (isset($HTTP_POST_VARS['iptc_name'])) ? intval($HTTP_POST_VARS['iptc_name']) : $iptc_name_default;
  
$dimension = (isset($HTTP_POST_VARS['dimension'])) ? intval($HTTP_POST_VARS['dimension']) : $dimension_default;
  
$user_id = (isset($HTTP_POST_VARS['user_id'])) ? intval($HTTP_POST_VARS['user_id']) : $user_info['user_id'];
  
$resize_type = (isset($HTTP_POST_VARS['resize_type'])) ? intval($HTTP_POST_VARS['resize_type']) : 1;
  
$quality = (isset($HTTP_POST_VARS['quality']) && intval($HTTP_POST_VARS['quality']) && intval($HTTP_POST_VARS['quality']) <= 100) ? intval($HTTP_POST_VARS['quality']) : $quality_default;
  
$dimension_thumbs = (isset($HTTP_POST_VARS['dimension_thumbs'])) ? intval($HTTP_POST_VARS['dimension_thumbs']) : $dimension_thumbs_default;
  
$resize_type_thumbs = (isset($HTTP_POST_VARS['resize_type_thumbs'])) ? intval($HTTP_POST_VARS['resize_type_thumbs']) : 1;
  
$quality_thumbs = (isset($HTTP_POST_VARS['quality_thumbs']) && intval($HTTP_POST_VARS['quality_thumbs']) && intval($HTTP_POST_VARS['quality_thumbs']) <= 100) ? intval($HTTP_POST_VARS['quality_thumbs']) : $quality_thumbs_default;
  
$big = (isset($HTTP_POST_VARS['big'])) ? $HTTP_POST_VARS['big'] : $big_default;
  
$annotate = (isset($HTTP_POST_VARS['annotate'])) ? $HTTP_POST_VARS['annotate'] : $annotate_default;
  
$big_folder = (isset($HTTP_POST_VARS['big_folder'])) ? trim($HTTP_POST_VARS['big_folder']) : $big_folder_default;
  
$subcats = (isset($HTTP_POST_VARS['subcats'])) ? trim($HTTP_POST_VARS['subcats']) : $subcats_default;
  
$subcats_checked = ($subcats == 1) ? " checked=\"checked\"" "";
  if (
$num_newimages == "" || !$num_newimages)
  {
    
$num_newimages 30;
  }


  
show_form_header("checkimages.php""checkimages");
  
show_table_header($lang['nav_images_check'], 2);
  
show_input_row($lang['num_newimages_desc'], "num_newimages"$num_newimages);
  
show_input_row($lang['cni_max_dim'], "max_dimension"$max_dimension);
//  show_table_separator("IPTC info", 2);
show_radio_row($lang['cni_iptc_name'], "iptc_name"$iptc_name);
show_radio_row($lang['cni_iptc_description'], "iptc_description"$iptc_description);
show_radio_row($lang['cni_iptc_keywords'], "iptc_keywords"$iptc_keywords);
show_radio_row($lang['cni_iptc_date'], "iptc_date"$iptc_date);
show_radio_row($lang['detailed_version'], "detailed"$detailed);
  
$desc get_category_dropdown_check($cat_id);
  
$desc .= "&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"checkbox\" name=\"subcats\" value=\"1\"".$subcats_checked.">".$lang['cni_check_subcat'];
 
show_custom_row($desc"<input type=\"submit\" value=\"".$lang['nav_images_check']."\" class=\"button\">");
  
show_table_footer();
  echo 
"</form>";
}

if (isset(
$HTTP_POST_VARS['action']) && $action == "checkimages")
{
  if (isset(
$HTTP_POST_VARS['detailed']) && $HTTP_POST_VARS['detailed'] == 1)
  {
    
$detailed 1;
    
$colspan 2;
  }
  else
  {
    
$detailed 0;
    
$colspan 7;
  }
  
$cat_id = (isset($HTTP_POST_VARS['cat_id_p'])) ? intval($HTTP_POST_VARS['cat_id_p']) : 0;
  
$cat_id_p $cat_id;
$image_list_sql = array();
$cats = array($cat_id);
  if (
$cat_id)
  {
    if (
$subcats)
    {
      
$sub_cat_cache $cat_parent_cache;
      
get_subcats($cat_id$cat_id);
    }

  $image_list_all = array();
    foreach (
$cats as $key)
    {
  
  $cat_path "/".$key;
  
  if ($handle opendir(MEDIA_PATH.$cat_path))
  
  {
    
  while ($file = @readdir($handle))
        {
    
    if ($file != "." && $file != "..")
          {
    
      if (check_media_type($file))
            {
    
        $image_list_all[$key][] = $file;
    
      }
    
    }
    
  }
    
  closedir($handle);
      }
  
}
    
$cat_sql implode(", "$cats);
foreach ($image_list_all as $key => $val)
    {
  sort($image_list_all[$key]);
}
}
else
{
    
$image_list_all = array();
    
$cat_image = array();
  if ($handle opendir(MEDIA_PATH))
  {
  
  while ($file = @readdir($handle))
      {
  
    if ($file != "." && $file != "..")
        {
  
      if (check_media_type($file))
          {
  
   $image_list_all[0][] = $file;
  
      }
  
    }
  
  }
    
closedir($handle);
    }
foreach ($image_list_all as $key => $val)
    {
  sort($image_list_all[$key]);
}
  $sql "SELECT cat_id
          FROM "
.CATEGORIES_TABLE;
  $result $site_db->query($sql);
  while ($row $site_db->fetch_array($result))
    {
  $cat_id $cats[] = $row['cat_id'];
  $cat_path = ($cat_id == 0) ? "" "/".$cat_id;
  if ($handle opendir(MEDIA_PATH.$cat_path))
  {
  
  while ($file = @readdir($handle))
        {
  
    if ($file != "." && $file != "..")
          {
  
      if (check_media_type($file))
            {
  
   $image_list_all[$row['cat_id']][] = $file;
  
      }
  
    }
  
  }
    
  closedir($handle);
      }
}
foreach ($image_list_all as $key => $val)
    {
  sort($image_list_all[$key]);
}
    
$cat_sql implode(", "$cats);
}
  
$sql "SELECT image_media_file, cat_id
          FROM "
.IMAGES_TABLE."
          WHERE cat_id IN (
$cat_sql)
          ORDER BY cat_id"
;
  
$result $site_db->query($sql);

  while (
$row $site_db->fetch_array($result))
  {
    
$image_list_sql[$row['cat_id']][] = $row['image_media_file'];
  }
foreach ($image_list_sql as $key => $val)
  {
  sort($image_list_sql[$key]);
}

  
$image_list = array();
  
$image_counter 0;
foreach ($image_list_all as $key => $val)
  {
  for ($i 0$i count($image_list_all[$key]); $i++)
    {
    if ($image_counter == $num_newimages)
      {
      break;
    }
    if (!@in_array($image_list_all[$key][$i], $image_list_sql[$key]))
      {
      $image_list[$key][] = $image_list_all[$key][$i];
      $image_counter++;
    }
  }
}
foreach ($image_list as $key => $val)
  {
  
sort($image_list[$key]);
}
  
$num_all_newimages $image_counter;

  if (
$msg != "")
  {
    
printf("<b>%s</b>\n"$msg);
  }

  
show_form_header("checkimages.php""savenewimages""form");

  
show_table_header($lang['cni_auto_resizer']."&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"auto_resize\" value=\"1\"".(($auto_resize) ? " checked" "").">".$lang['on']."&nbsp;<input type=\"radio\" name=\"auto_resize\" value=\"\"".(($auto_resize) ? "" " checked" ).">".$lang['off'], 2);
  
show_input_row($lang['resize_dimension_desc'], "dimension"$dimension);

$resize "\n<select name=\"resize_type\">\n";
  foreach (
$auto_thumbnail_resize_type_optionlist as $key => $val)
  {
    
$resize .= "<option value=\"$key\"";
    if (
$resize_type == $key)
    {
      
$resize .= " selected=\"selected\"";
    }
    
$resize .= ">$val</option>\n";
  }
$resize .= "</select>\n";
  
show_custom_row($lang['resize_proportions_desc'], $resize);

  
show_input_row($lang['resize_quality_desc'], "quality"$quality);
show_radio_row($lang['cni_save_orig'], "big"$big);
  
show_input_row($lang['cni_big_folder'], "big_folder"$big_folder);
  
show_radio_row($lang['cni_add_ann'], "annotate"$annotate);
  
show_table_separator($lang['cni_auto_thumbnailer']."&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"auto_thumbs\" value=\"1\"".(($auto_thumbs) ? " checked" "").">".$lang['on']."&nbsp;<input type=\"radio\" name=\"auto_thumbs\" value=\"\"".(($auto_thumbs) ? "" " checked" ).">".$lang['off'], 2);
  
show_input_row($lang['convert_thumbnail_dimension'], "dimension_thumbs"$dimension_thumbs);

$resize "\n<select name=\"resize_type_thumbs\">\n";
  foreach (
$auto_thumbnail_resize_type_optionlist as $key => $val)
  {
    
$resize .= "<option value=\"$key\"";
    if (
$resize_type_thumbs == $key)
    {
      
$resize .= " selected=\"selected\"";
    }
    
$resize .= ">$val</option>\n";
  }
$resize .= "</select>\n";
  
show_custom_row($lang['resize_proportions_desc'], $resize);

  
show_input_row($lang['convert_thumbnail_quality'], "quality_thumbs"$quality_thumbs);
  if (!
$detailed)
  {
    
show_table_separator($lang['user'], 2);
  show_user_select_row("Add as user"$user_id);
  }
  
show_table_footer();

  
show_hidden_input("cat_id_p"$cat_id_p);
  
show_hidden_input("mode"1);
  
show_table_header(preg_replace("/".$site_template->start."num_all_newimages".$site_template->end."/siU"$num_all_newimages$lang['checkimages_note']), $colspan);

  if (
$num_all_newimages)
  {
    
show_description_row("<input name=\"allbox\" type=\"checkbox\" onClick=\"CheckAll();\"".(($status) ? "" " checked=\"checked\"")." /> <b>".$lang['check_all']."</b>"$colspan);
  }
  else
  {
    
show_description_row($lang['no_newimages'], $colspan);
  }
  
$ii 0;
foreach ($image_list as $key => $val)
  {
$cat_id $key;
  
$cat_path = ($cat_id == 0) ? "" "/".$cat_id;
  $sql "SELECT cat_id, cat_name
          FROM "
.CATEGORIES_TABLE."
          WHERE cat_id = 
$cat_id
          LIMIT 1"
;
  $result $site_db->query_firstrow($sql);
$cat_name $result['cat_name'];
  for ($i 1$i <= count($image_list[$key]); $i++)
    {
    $ii++;
   //Check Image
    $file_type get_file_extension($image_list[$key][$i-1]);
      
$iptc_auto_now = (($iptc_name || $iptc_date || $iptc_description || $iptc_keywords) && $imageinfo = @getimagesize(MEDIA_PATH.$cat_path."/".$image_list[$key][$i-1], $info)) ? 0;
    $image_name get_file_name($image_list[$key][$i-1]);
    $date date("Y-m-d H:i:s"time());

    $thumb_file 0;
    if (file_exists(THUMB_PATH.$cat_path."/".$image_name.".jpg"))
      {
      $thumb_file $image_name.".jpg";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".JPG"))
      {
      $thumb_file $image_name.".JPG";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".jpeg"))
      {
      $thumb_file $image_name.".jpeg";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".JPEG"))
      {
      $thumb_file $image_name.".JPEG";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".gif"))
      {
      $thumb_file $image_name.".gif";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".GIF"))
      {
      $thumb_file $image_name.".GIF";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".png"))
      {
      $thumb_file $image_name.".png";
    }
    elseif (file_exists(THUMB_PATH.$cat_path."/".$image_name.".PNG"))
      {
      $thumb_file $image_name.".PNG";
    }
      
$image_name str_replace("_"" "$image_name);
      
$image_name str_replace("%20"" "$image_name);
      
$image_description $image_name;
//added the following line to get the cat name as the image name ..

  $image_name $cat_name;
    $checked = (isset($HTTP_POST_VARS['image_name_'.$ii]) && (!isset($HTTP_POST_VARS['addimage_'.$ii]) || $HTTP_POST_VARS['addimage_'.$ii] != 1) || $status) ? "" " checked=\"checked\"";

    if ($detailed)
      {
      show_table_separator("<input type=\"checkbox\" name=\"addimage_".$ii."\" value=\"1\"".$checked." /> ".$image_list[$key][$i-1], 2);
      show_custom_row($lang['cni_foundin']." ", ($cat_name == "" && !$key) ? "[".$lang['cni_root_folder']."]" $cat_name." (ID:$key)");
      if ($file_type == "gif" || $file_type == "jpg"  || $file_type == "png")
        {
        $file_src MEDIA_PATH.$cat_path."/".$image_list[$key][$i-1];
          
$img_info = @getimagesize($file_src);
          
$width $max_dimension;
          
$height $max_dimension;
          if (
$img_info[0] > && $img_info[1] > 0)
          {
        
if ($img_info[0] > $width || $img_info[1] > $height)
            {
        
   $ratio $img_info[0] / $img_info[1];
        
  if ($ratio 1)
              {
        
    $width $max_dimension;
        
    $height round(($max_dimension $img_info[0]) * $img_info[1]);
        
  }
        
  else
              {
        
    $width round(($max_dimension $img_info[1]) * $img_info[0]);
        
    $height $max_dimension;
        
  }
        
}
            else
            {
        
$width $img_info[0];
        
$height $img_info[1];
        
}
        
}
        show_image_row($lang['image']."<br /><span class=\"smalltext\">(".$img_info[0]."x".$img_info[1].")</span>"$file_src1""$height$width);
      }
      else
        {
        show_image_row($lang['image'], ICON_PATH."/".$file_type.".gif"1);
      }
      show_hidden_input("image_media_file_".$ii$image_list[$key][$i-1]);

      if ($thumb_file)
        {
        $thumb_src THUMB_PATH.$cat_path."/".$thumb_file;
          
$img_info = @getimagesize($thumb_src);
          
$width 48;
          
$height 48;
          
$dim $width;
          if (
$img_info[0] > && $img_info[1] > 0)
          {
        
if ($img_info[0] > $width || $img_info[1] > $height)
            {
        
   $ratio $img_info[0] / $img_info[1];
        
  if ($ratio 1)
              {
        
    $width $dim;
        
    $height round(($dim $img_info[0]) * $img_info[1]);
        
  }
        
  else
              {
        
    $width round(($dim $img_info[1]) * $img_info[0]);
        
    $height $dim;
        
  }
        
}
            else
            {
        
$width $img_info[0];
        
$height $img_info[1];
        
}
        
}
        show_image_row($lang['thumb'], $thumb_src1""$height$width);
        show_hidden_input("image_thumb_file_".$ii$thumb_file);
      }
      else
        {
        show_custom_row($lang['thumb'], $lang['no_thumb_newimages_ext']);
        show_hidden_input("image_thumb_file_".$ii"");
      }
      show_input_row($lang['field_download_url'].$lang['download_url_desc'], "image_download_url_".$ii""$textinput_size);


      $image_name = (isset($error['image_name_'.$ii]) && isset($HTTP_POST_VARS['image_name_'.$ii])) ? $HTTP_POST_VARS['image_name_'.$ii] : str_replace("_"," "$image_name);
        
$iptc "";
        if (isset(
$info['APP13']))
        {
          
$iptc iptcparse($info['APP13']);
        }
        if (
is_array($iptc) && $iptc_name)
        {
          if (isset(
$iptc['2#005'][0]))
          {
            
$image_name $iptc['2#005'][0];
          }
        }
      $title $lang['field_image_name'].((isset($file_src)) ? get_iptc_insert_link($file_src"object_name""image_name_".$ii0) : "");
      show_input_row($title"image_name_".$iistripslashes($image_name), $textinput_size);

      $title $lang['field_description_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"caption""image_description_".$ii) : "");
        
$caption "";
        if (
is_array($iptc) && $iptc_description)
        {
          
$caption = (isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";
// Uncomment lines below, to add date into captions
/*
          if (isset($iptc['2#055'][0]))
          {
            $caption .= (($caption != "") ? "\n" : "").$iptc['2#055'][0];
            $caption = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/", "\\1-\\2-\\3", $caption);
          }
*/
        
}
        
show_textarea_row($title"image_description_".$i$caption$textarea_size);

      $title $lang['field_keywords_ext'].((isset($file_src)) ? get_iptc_insert_link($file_src"keyword""image_keywords_".$ii) : "");
        
$keywords "";
        if (
is_array($iptc) && $iptc_keywords)
        {
          if (isset(
$iptc['2#025']))
          {
            foreach (
$iptc['2#025'] as $val)
            {
              
$keywords .= (($keywords != "" ) ? " " "").$val;
            }
          }
        }
//added following line to get auto keywords
//     $keywords =  "sexy $cat_name wallpapers, $cat_name gallery pictures, images, photo albums";
        
show_textarea_row($title"image_keywords_".$i$keywords$textarea_size);
      if (isset($error['cat_id_'.$ii]))
        {
    $title sprintf("<span class=\"marktext\">%s *</span>"$lang['field_category']);
  
}
        else
        {
  
$title $lang['field_category'];
  
}
  echo "<tr class=\"".get_row_bg()."\">\n<td><p class=\"rowtitle\">".$title."</p></td>\n<td>".get_category_dropdown($cat_id03$ii)."</td>\n</tr>\n";

      show_user_select_row($lang['user'], $user_id$ii);

        if (
is_array($iptc) && $iptc_date)
        {
          {
            
$date = (isset($iptc['2#055'][0])) ? preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/""\\1-\\2-\\3"$iptc['2#055'][0]) : $date;
          }
        }
      $title $lang['field_date'].$lang['date_desc'].$lang['date_format'].((isset($file_src)) ? get_iptc_insert_link($file_src"date_created""image_date_".$ii0) : "");
      show_input_row($title"image_date_".$ii$date$textinput_size);

      show_hidden_input("old_cat_id_".$ii$cat_id);
      show_radio_row($lang['field_free'], "image_active_".$ii1);
      show_radio_row($lang['field_allow_comments'], "image_allow_comments_".$ii1);
      show_additional_fields("image", array(), IMAGES_TABLE$ii);
    }
    else
      {
      echo "<tr class=".get_row_bg().">\n";
      echo "<td><input type=\"checkbox\" name=\"addimage_".$ii."\" value=\"1\"$checked></td>\n";
      $link "<a href=\"".MEDIA_PATH.$cat_path."/".$image_list[$key][$i-1]."\" target=\"_blank\">".$image_list[$key][$i-1]."</a>";
      show_hidden_input("image_media_file_".$ii$image_list[$key][$i-1]);
      if ($thumb_file)
        {
        $file_src THUMB_PATH.$cat_path."/".$thumb_file;
          
$img_info = @getimagesize($file_src);
          
$width 48;
          
$height 48;
          
$dim $width;
          if (
$img_info[0] > && $img_info[1] > 0)
          {
        
if ($img_info[0] > $width || $img_info[1] > $height)
            {
        
   $ratio $img_info[0] / $img_info[1];
        
  if ($ratio 1)
              {
        
    $width $dim;
        
    $height floor(($dim $img_info[0]) * $img_info[1]);
        
  }
        
  else
              {
        
    $width floor(($dim $img_info[1]) * $img_info[0]);
        
    $height $dim;
        
  }
        
}
            else
            {
        
$width $img_info[0];
        
$height $img_info[1];
        
}
        
}
        $thumb_status $lang['thumb_newimages_exists'];
        $thumb_status .= "<br><img src=\"".$file_src."\" width=\"".$width."\" height=\"".$height."\">";
        show_hidden_input("image_thumb_file_".$ii$thumb_file);
      }
      else
        {
        $thumb_status $lang['no_thumb_newimages'];
          if (
$thumbpreview)
          {
          $thumb_status .= "<br><img src=\"checkimages.php?action=showthumb&mode=".$image_list[$key][$i-1]."&cat_id=".$cat_id."\">";
        }
        show_hidden_input("image_thumb_file_".$ii"");
      }
      echo "<td><b>".$link."</b><br />-&raquo; ".$thumb_status."</td>\n";
      echo "<td>Found in: ".(($cat_name == "" && !$key) ? "[root folder]" "$cat_name (ID:$key)")."</td>\n";
      if (isset($error['image_name_'.$ii]))
        {
        $field_image_name sprintf("<span class=\"marktext\">%s</span>"$lang['field_image_name']);
        $image_name $HTTP_POST_VARS['image_name_'.$ii];
      }
      else
        {
        $field_image_name $lang['field_image_name'];//sprintf("%s", $lang['field_image_name']);
        $image_name = (isset($HTTP_POST_VARS['image_name_'.$ii])) ? $HTTP_POST_VARS['image_name_'.$ii] : str_replace("_"," "$image_name);
          if (
$iptc_auto_now)
          {
            if (isset(
$info['APP13']))
            {
              
$iptc iptcparse($info['APP13']);
              if (
is_array($iptc))
              {
                if (
$iptc_name && isset($iptc['2#005'][0]))
                {
                  
$image_name =  $iptc['2#005'][0];
                }
                
$caption = ($iptc_description && isset($iptc['2#120'][0])) ? $iptc['2#120'][0] : "";
                
$keywords "";
                if (
$iptc_keywords && isset($iptc['2#025']))
                {
                  foreach (
$iptc['2#025'] as $val)
                  {
                    
$keywords .= (($keywords != "" ) ? " " "").$val;
                  }
                }
                if (
$iptc_date)
                {
                  
$date = (isset($iptc['2#055'][0])) ? preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/""\\1-\\2-\\3"$iptc['2#055'][0]) : $date;
                }
              }
            }
          }
      }
      echo "<td>".$field_image_name.":<br /><input type=\"text\" name=\"image_name_".$ii."\" value=\"".stripslashes($image_name)."\">\n";
          
$field_description  $lang['field_description'];
      echo "<td>".$field_description.":<br /><input type=\"text\" name=\"image_description_".$ii."\" value=\"".stripslashes($image_description)."\">\n";
$field_category $lang['field_category'];
      if (isset($error['cat_id_'.$ii]))
        {
        $field_category sprintf("<span class=\"marktext\">%s</span>"$lang['field_category']);
      }
      $cat_id = (isset($HTTP_POST_VARS['cat_id_'.$ii])) ? intval($HTTP_POST_VARS['cat_id_'.$ii]) : $cat_id;
      echo "<td>".$field_category.":<br />".get_category_dropdown($cat_id03$ii)."</td>\n";
      show_hidden_input("old_cat_id_".$ii$cat_id);
      show_hidden_input("image_description_".$iihtmlspecialchars($caption));
      show_hidden_input("image_keywords_".$iihtmlspecialchars($keywords));
      show_hidden_input("image_date_".$iihtmlspecialchars($date));

      echo "<td>".$lang['field_free'].":<br />";
      if (isset($HTTP_POST_VARS['image_active_'.$ii]) && $HTTP_POST_VARS['image_active_'.$ii] == 0)
        {
        $c1 "";
        $c2 " checked=\"checked\"";
      }
      else
        {
        $c1 " checked=\"checked\"";
        $c2 "";
      }
      echo "<input type=\"radio\" name=\"image_active_".$ii."\" value=\"1\"".$c1."> ".$lang['yes']."&nbsp;&nbsp;&nbsp;\n";
      echo "<input type=\"radio\" name=\"image_active_".$ii."\" value=\"0\"".$c2."> ".$lang['no']." ";
      echo "</td>\n";

      echo "<td>".$lang['field_allow_comments'].":<br />";
      if (isset($HTTP_POST_VARS['image_allow_comments_'.$ii]) && $HTTP_POST_VARS['image_allow_comments_'.$ii] == 0)
        {
        $c1 "";
        $c2 " checked=\"checked\"";
      }
      else
        {
        $c1 " checked=\"checked\"";
        $c2 "";
      }
      echo "<input type=\"radio\" name=\"image_allow_comments_".$ii."\" value=\"1\"".$c1."> ".$lang['yes']."&nbsp;&nbsp;&nbsp;\n";
      echo "<input type=\"radio\" name=\"image_allow_comments_".$ii."\" value=\"0\"".$c2."> ".$lang['no']." ";
      echo "</td>\n";
      echo "</tr>\n";
//       show_hidden_input("user_id_".$ii, $user_id);
    }
  }
}
  if (
$num_all_newimages)
  {
  
show_hidden_input("max_dimension"$max_dimension);
  
show_hidden_input("num_newimages"$num_newimages);
    
show_hidden_input("detailed"$detailed);
    
show_hidden_input("subcats"$subcats);
    
show_hidden_input("mode"1);
    
show_form_footer($lang['add'], $lang['reset'], $colspan);
  }
  else
  {
    
show_table_footer();
  }
}
show_admin_footer();
?>




Thanks
Batu


Never mind... I fixed this..  :)

37
Chit Chat / Red-D3v1L Hack
« on: May 30, 2009, 11:47:29 PM »
Hi All-
              couple of days back when I tried to login into my website as a admin, it suddenly stopped taking my password and when I requested a new password then I didn't get the new password.. So, I checked my database and got to know that my e-mail id and password has been changed. I think this is a some kind of hack.

   Today while searching my site name in google I noticed my website name is also in this list..  http://www.zone-h.org/archive/ip=72.29.71.175   

I finally deleted index.htm file from bhwallpapers.com/wall   folder.

No idea how and why this happened .. Is this happened due to some security hole in 4image. ?

I am still using 1.7.4


Thanks
batu544


38
Discussion & Troubleshooting / My site is not working .. !
« on: December 09, 2008, 07:07:28 PM »
Hi,
     My website is not working !!! Can any one check it .. but signature is working ..  I am not able to understand why its happening ..



web : www.bhwallpapers.com

thanks

39
Mods & Plugins (Requests & Discussions) / Search by image size
« on: December 03, 2008, 02:18:17 PM »
Hi All,
          Is it possible to search the images by its size ?? for example if I will search for 800x600 size then it will return only 800x600 size images.


thanks

40
Hi all,

here is a way to watermark the images on-fly instead of actually watermarking the images.. When the user will try to download, the original image will be downloaded...  :D


1. Upload the following file as watermark.php

Code: [Select]
<?php

header
('content-type: image/jpeg');
$img $_GET['img'];
$watermark imagecreatefrompng('watermark.png');

$watermark_width imagesx($watermark);
$watermark_height imagesy($watermark);
$image imagecreatetruecolor($watermark_width$watermark_height);
$image imagecreatefromjpeg("$img");
$size getimagesize("$img");
$dest_x $size[0] - $watermark_width 5;
$dest_y $size[1] - $watermark_height 5;

imagecopymerge($image$watermark$dest_x$dest_y00$watermark_width$watermark_height100);
imagejpeg($image);
imagedestroy($image);
imagedestroy($watermark);

?>


2. Open jpg.html from your template/xxx/media folder and change
Code: [Select]
<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />
to

Code: [Select]
<img src="./watermark.php?img={media_src}" border="1" alt="{image_name}"{width_height} /><br />


3. Upload your watermark.png picture.. to root folder.

4. Now all set .. you can see the watermarked images ..   :D


Demo : bhwallpapers  ( You need to click on the image to see the actual watermarked image )
Thanks

Edit: Sorry, now the demo is not available due to the changes in the website design.. :(

41
Chit Chat / User rebecca0813
« on: October 12, 2008, 07:12:03 AM »
Hi All,
           Is this user "rebecca0813"  a bot ?? I think its only spamming here..

Thanks,

42
Discussion & Troubleshooting / virtual Users .. !!!
« on: September 21, 2008, 10:33:22 PM »
Hi All,
            I was noticing this thing for a long time in my 4image gallery. If 1 or 2 users are visiting my website, then I can see atleast 5-6 users are visiting to my site from some fixed Ip address. Do anyone have any idea why this is happening ? Is there any effect on performance for this reason ?


here I have attached the screen shot of my ACP screen while 2-3 users are online.




Thanks,
Batu

43
Mods & Plugins (Requests & Discussions) / Selected images in one Category
« on: September 21, 2008, 01:42:16 PM »
Hi,
     I have created one category and I need to show all the images in this category from all other categories where the description of the images  matches to "xyz"

Can anyone tell me how can I do this ?


To achieve this I have done the following changes in category.php and its working ..Its retrieving all the images correctly from other categories but the count of those images and paging is not correct .. Its still displaying the total images of the original category.

Existing code :

Code: [Select]
$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")."
        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'].", image_id ".$config['image_sort']."
        LIMIT $offset, $perpage";


New code:
Code: [Select]
if ($cat_id == 55) {

$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")."
        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.image_description like '%xyz%' and c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
        LIMIT $offset, $perpage";
} else {
$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")."
        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'].", image_id ".$config['image_sort']."
        LIMIT $offset, $perpage";
}


Is there any other place I am missing to make changes ??

Thanks,

44
Templates & Styles (Requests & Discussions) / <html dir="{direction}">
« on: September 20, 2008, 05:12:56 PM »
Hi,
     I just noticed <html dir="{direction}">  in my header.html template. Can anyone tell me what is the use of this ?





Thanks,
batu



45
Discussion & Troubleshooting / Check new images log
« on: August 05, 2008, 08:11:49 PM »
Hi All,
         I am trying to upload some images in my gallery and the images are very big size and I am getting the error messgae "Check new images log" . the particular image will be renamed to .bak file.

 Can anyone help to solve this problem ?


Pages: 1 2 [3] 4