4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: budduke on September 16, 2008, 11:41:46 PM

Title: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on September 16, 2008, 11:41:46 PM
[MOD] Multi download size ver 4.7
This MOD will allow your users to download multiple different sizes of one image.
see the attached screenshot to see what it looks like.

* You can modify the sizes in the Global.php file to set the range you want your users to download.
* Added variables in the global.php file for easy customizing of mod for your site.(New to ver 2.1)
* Added variables that you can now set crop settings to get actual size when resizing (New to ver 3.0)
* You can now have text links and image links instead of dropdown list (New to ver 2.1)
* You can select if the catagory uses this option or the normal download/zip option instead.
* You can set the category to only allow sizes smaller then original to be downloaded (New to ver 2.0)
* Original file is an option on the list, if your user does not want it resized. (New to ver 2.0)
* You only need to upload one size of the file and the server will do the rest for you (I am lazy)
  all the other mods I saw wanted you to create all the different sizes before you uploaded them.
  This mod will create the resized images at the time the user is asking for them.
* Also, if nobody ever downloads a 640X480 image then you do not have the extra images on your server.
* The MOD does check to see if it already created the size so it does not have to create it twice.
* If file is not an image you will get the normal download button instead.(New to ver 3.1)
* You can now group the button/links/dropdown for easier navigation. (New to ver 4.0)
* Now instead of downloading the images, you can have a popup window instead if you choose. (New to ver 4.0)
* Have added where it will detect the users screen resolution for easier choosing. (New to ver 4.0)
* added more selections in default list for mobile phones (New to ver 4.0)
* added exact ratio selection taken from original file for size selections. is turned off by default (New to ver 4.2)
* added a template for popup window (New to ver 4.4)

I was having a hard time creating a way to remove the extra files if you delete images/or move them.
I wound up just making a plugin that you run in the admin cp that will erase all resized images from the server.

This MOD was tested on a fresh install of 1.7.11 and everything worked fine

Changes made in Version 4.7
--Fixed a problem where not downloading on mobile devices using the dropdown list.

Changes made in Version 4.6
--Fixed a problem where not displaying image name in popup window.

Changes made in Version 4.5
--Fixed a problem where it was pulling the sizes from the random image instead of the main image on detail page

Changes made in Version 4.4
--I fixed a division by 0 error warning that I was getting with this mod.
--Added template for popup window.
--Added annotation link to resized image (if using that mod)
Changes made in Version 4.3
--I had a major problem with dealing with sessions on my links. They are repaired on this release.
--Good news, you only have to replace the insert in the includes/functions.php file to fix this error.

backup your database in case something goes wrong and also backup these files before you proceed.
I would also suggest using it on a testing site and not your main one in case something crashes
These are the files that will be modified...
details.php
download.php
global.php
admin/categories.php
includes/constants.php
includes/functions.php
lang/english/admin.php
lang/english/main.php
template/your template you are using/details.html

The zip file attached contains the plugin and the installer and the graphic buttons for your site.

The plugin needs to be placed in the
admin/plugins folder

place the multi_download_install.php in your root folder of your gallery and run it once so it can install the
new multi_download field into your categories table.
Make sure you delete it afterward for security.

in the global.php file

look for
Code: [Select]
 $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcommentreplace with
Code: [Select]
 $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, multi_download
look for
Code: [Select]
?>insert Before (changed in version 2) (updated in version 4.0) (updated in version 4.2)
Code: [Select]
// MOD multi download
$download_multi_sizes= array(
array('group1',0,0), //Groups are created in this format, group1 name is associated with a language entry with the same name (the 0,0 is important!)
array('800x600',800,600),
array('1024x768',1024,768),
array('1280x960',1280,960),
array('1400x1050',1400,1050),
array('1600x1200',1600,1200),
array('2048x1536',2048,1536),
array('group2',0,0),
array('1280x720',1280,720),
array('1366x768',1366,768),
array('1920x1080',1920,1080),
array('2560x1440',2560,1440),
array('group3',0,0),
array('1280x800',1280,800),
array('1440x900',1440,900),
array('1680x1050',1680,1050),
array('1920x1200',1920,1200),
array('2560x1600',2560,1600),
array('group4',0,0),
array('96x65',96,65),
array('101x80',101,80),
array('128x128',128,128),
array('128x160',128,160),
array('174x132',174,132),
array('240x320',240,320),
array('group5',0,0),
array('240x160',240,160),
array('240x260',240,260),
array('240x240',240,240),
array('320x240',320,240)
);
// the first field is the name that is shown in the list that you choose from
// the second field is the width
// the third field is the height
$multi_download_var['type'] = 0; //0=dropdown, 1=text links, 2=image links
$multi_download_var['columns'] = 4; // #of columns in table for links, not used for dropdown
$multi_download_var['button']="gif"; //type of file for your image link buttons gif,jpg,png
$multi_download_var['bold_groups']=1; //Bold option group labels (only for text links and buttons), 1=yes, 0=no
$multi_download_var['center_groups']=1; //Center option group labels (only for text links and buttons), 1=yes, 0=no
$multi_download_var['show_resolution']=1;// Display user's display resolution, 1=yes, 0=no
$multi_download_var['download']=1; //display "select size to download at top of table" 1=yes, 0=no
$multi_download_var['table']=220; //width of table that will house this MOD, 220 is good for dropdown, 420 is good for others
$multi_download_var['show_table']=1; //show border and shading in back of MOD, 1=yes,0=no
$multi_download_var['show_original']=1; //display "original image" as an option 1=yes, 0=no
$multi_download_var['newline_original']=1; //place 'original size' button on its own line, 1=yes, 0=no
$multi_download_var['center_original']=1; //center 'original size' button with space that is left in row, 1=yes, 0=no
$multi_download_var['alt_image']=1; //Use Alt variable with image links, 1=yes,0=no
$multi_download_var['crop']=0; //crop image after resize  (see below)
/* what crop will do is resize image larger then size that is asked for unless it detects it will resize without and extra space.
then it will crop off the extra area to give you the actual size asked for (loosing part of your image)
0= do not crop
1= crop equally on both sides
2= crop top or left side
3= crop bottom or right side
4= resize and stretch to fit requested size (no crop)
*/
$multi_download_var['quality']= 90; //quality settings for resizing/cropping 10-100 (10=high compression, 100= lowest compression)
$multi_download_var['target']="";// for popup window instead of download replace the quote with  "TARGET = '_blank' "  
// You can also replace _blank with a name like mypopup and then all images will open in same popup window
$multi_download_var['ratio']=0; //Only sizes that fit size ratio of original will be available (must be exact match on ratio!)
// END MOD multi download
this was the original insert for removal purposes if upgrading from beta to ver 2 or above
Code: [Select]
// MOD multi download
$download_multi_sizes= array(
array('640X480',640,480),
array('800X600',800,600),
array('1024X768',1024,768),
array('1280X960',1280,960),
array('1400X1050',1400,1050),
array('1600X1200',1600,1200),
array('1280X800-wide',1280,800),
array('1440X900-wide',1440,900),
array('1680X1050-wide',1680,1050),
array('1920X1200-wide',1920,1200)
);
// the first field is the name that is shown in the list that you choose from
// the second field is the width
// the third field is the height

$multi_download_options_string="<BR><BR>
<form action='".ROOT_PATH.'download.php'."' method='post'>
<table border='0' cellspacing='1' cellpadding='0' width='210'  class='head1'>
<tr><td><table border='0' cellspacing='0' cellpadding='0' width='210' class='row2'><tr>
<td colspan='2' align='center'>".$lang['multi_select']."</TD></TR>
<TR class='row1'><TD><select name='multi_download_select'>";
$var=0;
while ($var < count($download_multi_sizes)){
$multi_download_options_string .="<option value='".$var."'>".$download_multi_sizes[$var][0]."</option>";
$var = $var +1;
}
$multi_download_options_string .="</select>";
// END Multi Download

in the admin/categories.php file

look for
Code: [Select]
$access_array = array(
  AUTH_ALL => $lang['all'],
  AUTH_USER => $lang['userlevel_registered'],
  AUTH_ACL => $lang['private'],
  AUTH_ADMIN => $lang['userlevel_admin']
);

insert after (new for ver2.0)
Code: [Select]
// MOD multi download
function show_radio_row_multi($title, $name, $value = 0) {
  global $HTTP_POST_VARS, $lang, $multi_download_optionlist;
  if (isset($HTTP_POST_VARS[$name])) {
    $value = $HTTP_POST_VARS[$name];
  }
  echo "<tr class=\"".get_row_bg()."\">\n";
  echo "<td><p class=\"rowtitle\">".$title."</p></td>\n<td><p>";
  foreach ($multi_download_optionlist as $key => $val) {
    echo "<input type=\"radio\" name=\"".$name."\" value=\"$key\"";
    if ($value == $key) {
      echo " checked=\"checked\"";
    }
    echo "> ".$val."<br />";
  }
  echo "</p></td>\n</tr>";
}
// END MOD multi download

look for 2 times
Code: [Select]
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];insert after Both places
Code: [Select]
// MOD Multi Download
  $multi_download = (isset($HTTP_POST_VARS['multi_download'])) ? intval($HTTP_POST_VARS['multi_download']) : 0;
// END MOD Multi download

look for
Code: [Select]
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcommentreplace with
Code: [Select]
(cat_name, cat_description, cat_parent_id, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, multi_download
look for
Code: [Select]
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcommentreplace with
Code: [Select]
('$cat_name', '$cat_description', $cat_parent_id, $cat_order, $auth_viewcat, $auth_viewimage, $auth_download, $auth_upload, $auth_directupload, $auth_vote, $auth_sendpostcard, $auth_readcomment, $auth_postcomment, $multi_download
look for
Code: [Select]
 $permission_headline = $lang['permissions'];insert before (changed insert for ver 2.0)
Code: [Select]
// MOD multi download
  $value = intval($cat_row['multi_download']);
  show_radio_row_multi($lang['multi_option'],'multi_download',$value);
// END MOD multi download

look for
Code: [Select]
   $sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcommentreplace with
Code: [Select]
   $sql = "SELECT cat_name, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, multi_download

look for
Code: [Select]
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcommentreplace with
Code: [Select]
SET cat_name = '$cat_name', cat_description = '$cat_description', cat_parent_id = $cat_parent_id, cat_order = $cat_order, cat_hits = $cat_hits, auth_viewcat = $auth_viewcat, auth_viewimage = $auth_viewimage, auth_download = $auth_download, auth_upload = $auth_upload, auth_directupload = $auth_directupload, auth_vote = $auth_vote, auth_sendpostcard = $auth_sendpostcard, auth_readcomment = $auth_readcomment, auth_postcomment = $auth_postcomment, multi_download = $multi_download
look for
Code: [Select]
 $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcommentreplace with
Code: [Select]
 $sql = "SELECT cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, multi_download
look for
Code: [Select]
 show_table_separator($lang['permissions'], 2);insert before (changed insert for ver 2.0)
Code: [Select]
// MOD multi download
$value = intval($cat_row['multi_download']);
show_radio_row_multi($lang['multi_option'],'multi_download',$value);
// END MOD multi download

in the details.php file

look for
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").get_user_table_field(", u.", "user_email")."replace with
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").get_user_table_field(", u.", "user_email").", c.multi_download
look for
Code: [Select]
$is_image_owner = ($image_row['user_id'] > USER_AWAITING && $user_info['user_id'] == $image_row['user_id']) ? 1 : 0;insert after (Updated insert for ver 3.1)
Code: [Select]
// MOD multi download
$multi_download = $image_row['multi_download'];
if($multi_download){
if(!strpos(",jpg,jpeg,JPG,JPEG,png,gif",pathinfo($image_row['image_media_file'], PATHINFO_EXTENSION))){
$multi_download=0;
}
}
// END MOD multi download

look for
Code: [Select]
//-----------------------------------------------------
//---Clickstream---------------------------------------
//-----------------------------------------------------
insert before
Code: [Select]
//MOD multi download
if (!$multi_download){
$site_template->register_vars("yes_multi_download", 0);
$site_template->register_vars("not_multi_download", 1);
}
else{
$site_template->register_vars("yes_multi_download", 1);
$site_template->register_vars("not_multi_download", 0);
}
//END MOD multi download

in the download.php file

look for
Code: [Select]
 $sql = "SELECT image_id, cat_id, user_id, image_media_file, image_download_url, image_downloads
          FROM ".IMAGES_TABLE."
          WHERE image_id = $image_id AND image_active = 1";
  $image_row = $site_db->query_firstrow($sql);
insert before (updated insert for version 2.1)
Code: [Select]
// MOD multi download
  if ($_POST['action'] == "resize" || $_GET['action'] == "resize"){
$multi_download_select = (isset($HTTP_GET_VARS['multi_download_select'])) ? intval($HTTP_GET_VARS['multi_download_select']) : intval($HTTP_POST_VARS['multi_download_select']);
$size = MULTI_DOWNLOAD_SEP.$download_multi_sizes[$multi_download_select][0];
}
// END MOD multi download
Also on the first line of the "look for" code above (new replace for version 4.4)
add new code to the end of the first line so it looks like this (Updated the code for version 4.6)
Code: [Select]
 $sql = "SELECT image_id, cat_id, user_id, image_media_file, image_download_url, image_downloads, image_keywords, image_description, image_name

look for
Code: [Select]
 if ($user_info['user_level'] != ADMIN) {
    $sql = "UPDATE ".IMAGES_TABLE."
            SET image_downloads = image_downloads + 1
            WHERE image_id = $image_id";
    $site_db->query($sql);
insert before (Updated insert for ver 3.0)(Updated insert for ver 4.4)
Code: [Select]
// MOD multi download
if ($size){
$multi_resize=get_file_path($regs[1].'.'.$regs[2], "big", $image_row['cat_id'], 0, 1);
if (!file_exists($multi_resize)){
$multi_resize = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$regs[1].'.'.$regs[2] : MEDIA_PATH."/".$image_row['cat_id']."/".$regs[1].'.'.$regs[2];
}
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$multi_new_image=(is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".MULTI_BIG_FOLDER."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".MULTI_BIG_FOLDER."/".$file['file_name'];
$file['file_path'] = $multi_new_image;
$multi_dir=dirname($multi_new_image);
if (!file_exists($multi_new_image)){
if (!@is_dir($multi_dir)){
$oldumask = umask(0);
$result = mkdir($multi_dir);
umask($oldumask);
if (!@is_dir($multi_dir) || !$result) {
$result = mkdir($multi_dir, 0755);
}
}
$multi_var = multi_download_resize($multi_resize,$multi_new_image,$multi_download_var['quality'],$download_multi_sizes[$multi_download_select][1],$download_multi_sizes[$multi_download_select][2]);
if ($multi_var !== $multi_resize){
$file['file_path'] = $multi_new_image;
//-------------------------------------------------------------------------------------------
// --- Annotate Resized Images ----------------------------------------------------------------------
//-------------------------------------------------------------------------------------------
if ($config['annotation_use'] && strtolower($file_extension == jpg)) {
require(ROOT_PATH.'includes/annotate.php');
$ann_user_name = ($user_info['user_name']);
annotate_image($file['file_path']);
}
//-------------------------------------------------------------------------------------------
}
else {
$file['file_name'] = $file_name.".".$file_extension;
$file['file_path'] = $multi_resize;
}
}
}

// END MOD multi download

look for (New for ver 4.0- only needed if you want a popup window instead of download)(Updated for V4.4 to include template)
Code: [Select]
send_file($file['file_name'], $file['file_path']);
Replace with (Updated in V4.6)
Code: [Select]
//MOD multi download for popup window
if (($multi_download_var['target']<>"") && $size){
   $meta_keywords  = !empty($image_row['image_keywords']) ? implode(", ", explode(",", $image_row['image_keywords'])) : "";
$meta_description = !empty($image_row['image_description']) ? strip_tags($image_row['image_description']) . ". " : "";
$image_name = format_text($image_row['image_name'], 2);
                                  $site_template->register_vars(array(
"img_url" => $file["file_path"],
"site_name" => $config['site_name'],
"charset" => $lang['charset'],
"direction" => $lang['direction'],
"detail_meta_description"   => $meta_description,
            "detail_meta_keywords"      => $meta_keywords,
            "prepend_head_title"        => $image_name . " - "
));
$site_template->print_template($site_template->parse_template("multi_popup"));
}
else{
        send_file($file['file_name'], $file['file_path']);
    }
//END MOD multi download for popup window

in the includes\constants.php file

look for
Code: [Select]
?>insert before
Code: [Select]
// MOD multi download
define ('MULTI_BIG_FOLDER' , 'big'); //This is the name of the 'big' folder or the name of a seperate subfolder for resizing of images.
define ("MULTI_DOWNLOAD_SEP","_resized_");//an underscore will be added to this variable before it is attached (which in this case will make 2 underscores)
//this is what this Mod uses as a seperator from all the files it creates on your server.
// the format will be 'yourfilename_ (whatever the sep is set for)(and the names of your option for that size).jpg'
//example: if I have an option for 1024X768 the new name would be 'yourfilename__resized_1024X768.jpg' notice the 2 underscores in a row at the beginning, one is built in and the other is an option that you can take away if needed.
//NOTE: when this mod is cleaning up it is looking for any file with '_ (whatever the sep is set for)' [example '__resized_'] is what the mod is looking for, (notice the 2 underscores in a row at the beginning)
//             I am assuming that you will not EVER have '__resized_' in any of your normal filenames, if you do, then you need to change the SEP variable to something that you will never use in a filename or you can have the MOD store the
//             resized images in a different subfolder then the 'big' folder that is above and then the seperator will not matter. The Mod will create the new subfolder on the fly while it is running.
// END MOD multi download

in the includes\functions.php file

look for
Code: [Select]
function show_image($image_row, $mode = "", $show_link = 1, $detailed_view = 0) {
  global $self_url, $site_template, $site_sess, $user_info, $config, $cat_cache, $lang, $additional_image_fields, $user_table_fields, $url_show_profile;
insert after (changed insert for ver 2.0) (updated insert for ver 2.1)
Code: [Select]
 global $download_multi_sizes, $multi_download_var, $site_db;// MOD multi downloadoriginal insert that needs replaced if upgrading from beta to ver 2.0
Code: [Select]
 global $multi_download_options_string;// MOD multi download
ONLY ADD THIS MODIFICATION IF IT IS NOT ALREADY THERE FROM THE BIG MOD! (NEW TO VER 2.0 and above)  
look for
Code: [Select]
   $check_handle = "check_".$image_type."_type";
    $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]
// MOD multi download (with needed info for big directory if not using that mod)
    $check_handle = "check_".$image_type."_type";
//    $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;
// Download file block insert BEGIN
    switch( $image_type ) {
 case "media":
   if( $cat_id ){
     $path = MEDIA_PATH."/".$cat_id;
}else{
 $path = MEDIA_TEMP_PATH;
                        }
   break;
      case "big":
        $path = MEDIA_PATH."/".$cat_id."/big";
   break;
      case "download":
        $path = MEDIA_PATH."/".$cat_id."/download";
   break;
 default:
   if( $cat_id ){
     $path = THUMB_PATH."/".$cat_id;
}else{
 $path = THUMB_TEMP_PATH;
                        }
   break;
}
$path .= "/".$file_name;
// Download file block insert END
    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" && $image_type != "big") ? $return_code : ""); // Download file :: V@no big mod
// END MOD multi download (with needed info for big directory if not using that mod)

look for (new to ver 2.0)(Changed in ver 4.5, read this posthttp://www.4homepages.de/forum/index.php?topic=22741.msg163311;topicseen#msg163311 (http://www.4homepages.de/forum/index.php?topic=22741.msg163311;topicseen#msg163311) )
Code: [Select]
 $rate_form = "";
  if (check_permission("auth_vote", $image_row['cat_id'])) {
    $site_template->register_vars("rate", $lang['rate']);
    $rate_form = $site_template->parse_template("rate_form");
  }
  $site_template->register_vars("rate_form", $rate_form);
  $site_template->register_vars(array(
    "image" => 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),
  ));
insert After (updated insert for ver 3.1) (updated for ver 4.1) (updated for ver 4.2)(updated/repaired for ver 4.3)(updated for ver 4.5)(updated for ver 4.7)
Code: [Select]
// MOD multi download
if ($detailed_view){
 $sql = "SELECT multi_download
        FROM ".CATEGORIES_TABLE."
        WHERE cat_id = ".$image_row['cat_id']." ";
 $result = $site_db->query_firstrow($sql);
 $multi_download = $result['multi_download'];
}
if ($multi_download && $detailed_view){
if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_colvar = 0;
if ($multi_download_var['show_table']){
$multi_download_class1 = "class='head1'";
$multi_download_class2 = "class='row1'";
$multi_download_class3 = "class='row2'";
}
else {
$multi_download_class1 = "";
$multi_download_class2 = "";
$multi_download_class3 = "";
}
$multi_download_group0 = ($multi_download_var['center_groups'] ? "align='center'" : "");
// change the code below to change how your monitor resolution is displayed
$multi_download_resolution = "<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'><B>".$lang['multi_resolution']."<script type='text/javascript'>document.write(screen.width+'X'+screen.height)</script></B></TD></TR>";
if ($multi_download_var['bold_groups']){
$multi_download_group1= "<B>";
$multi_download_group2= "</B>";
}
else{
$multi_download_group1= "";
$multi_download_group2= "";
}
if (!$multi_download_var['type']){
$multi_download_options = "<BR><BR><form action='".$site_sess->url(ROOT_PATH."download.php")."' method='get'".$multi_download_var['target']."><table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."'  ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .="<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD></TR>";
}
$multi_download_options .="<TR ".$multi_download_class2."><TD><select name='multi_download_select'>";
}
else{
$multi_download_options = "<table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."' ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .= "<tr ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD>";
}
}
$var=0;
$down_group=0;
$down_group_flag=0;
$multi_download_group="";
$multi_download_colvar=0;
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {
$max_width = $site_template->val_cache['width'];
$max_height = $site_template->val_cache['height'];
}
$varcount= count($download_multi_sizes);
while ($var < $varcount){
if ($download_multi_sizes[$var][1] == '0'){
if ((!$down_group) && ($multi_download_group<>"")){
if (!$multi_download_var['type']) {
$multi_download_options .=$multi_download_group;
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
$multi_download_options .= "<tr ".$multi_download_class2.">".$multi_download_group."</tr>";
}
}
if ($down_group && $down_group_flag){
if (!$multi_download_var['type']) {
$multi_download_group .= "</optgroup>";
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
}
$multi_download_options .= $multi_download_group;
}
$down_group=1;
$down_group_flag=0;
if (!$multi_download_var['type']) {
$multi_download_group ="<optgroup label='".$lang['multi_down_'.$download_multi_sizes[$var][0]]."'>";
}
else{
$multi_download_group ="</tr><tr ".$multi_download_class3."><td colspan='".$multi_download_var['columns']."' ".$multi_download_group0.">".$multi_download_group1.$lang['multi_down_'.$download_multi_sizes[$var][0]].$multi_download_group2."</TD></TR><tr ".$multi_download_class2.">";
$multi_download_colvar = 0;
}
}
else{
if ((($download_multi_sizes[$var][1] <= $max_width && $download_multi_sizes[$var][2] <= $max_height)&&($multi_download =='2'))||($multi_download=='1')){
 if (((($max_width/$max_height)==($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2]))&&($multi_download_var['ratio']))||(!$multi_download_var['ratio'])){
switch($multi_download_var['type']){
case (1) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
break;
case (2) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target']."><img src='".get_gallery_image($download_multi_sizes[$var][0].".".$multi_download_var['button'])."' ";
if ($multi_download_var['alt_image']){
$multi_download_group .= "alt='".$download_multi_sizes[$var][0]."' ";
}
$multi_download_group .="border='0'></a></td>";
break;
case (0) :
default:
$multi_download_group .="<option value='".$var."'>".$download_multi_sizes[$var][0]."</option>";
break;
}
$down_group_flag=1;
$multi_download_colvar++;
 }
}
if (($multi_download_colvar == $multi_download_var['columns']) && ($multi_download_var['type']>0)){
$multi_download_colvar = 0;
$multi_download_group .="</tr><tr ".$multi_download_class2.">";
}
}
$var++;
}
if (($down_group==1) && (!$multi_download_var['type'])){
$multi_download_group .="</optgroup>";
}
if($down_group_flag){
$multi_download_options .=$multi_download_group;
}else{
$multi_download_colvar = 1;
}
$multi_download_colvar2= $multi_download_colvar;
$multi_download_colvar = $multi_download_var['columns'] - $multi_download_colvar;
if ($multi_download_var['center_original']){
$multi_download_colvar1= $multi_download_colvar;
}
else{
$multi_download_colvar1= 1;
$multi_download_colvar--;
}
switch ($multi_download_var['type']){
case(1):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target'].">".$lang['original_size']."</a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(2):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target']."><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";
if($multi_download_var['alt_image']){
$multi_download_options .= "alt='".$lang['original_size']."' ";
}
$multi_download_options .="border='0'></a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(0):
default:
if ($multi_download_var['show_original']){
$multi_download_options .="<option value='".$var."'>".$lang['original_size']."</option>";
}
$multi_download_options .="</select>";
$multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
</TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
<input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
break;
}
$allow_download = 1;
set_download_token($image_row['image_id']);
}
$site_template->register_vars("multi_download_options", $multi_download_options);
unset($multi_download_options);
}

// END MOD multi download

look for (this insert no longer needed in ver 2.0 or above) (left here so upgrade users can delete)
Code: [Select]
if (!check_permission("auth_sendpostcard", $image_row['cat_id'])) {insert before(remove this insert if upgrading from beta to ver 2.0)
Code: [Select]
// MOD multi download

if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_options = $multi_download_options_string;
    $multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
                   </TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
                    <input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
//
$allow_download = 1;
    set_download_token($image_row['image_id']);

}
$site_template->register_vars("multi_download_options", $multi_download_options);
// END MOD multi download

look for
Code: [Select]
?>insert before (updated insert for ver 3.1)
Code: [Select]
// MOD multi download
function multi_download_resize($file, $new_file, $quality, $resize_width, $resize_height) {
  global $convert_options,$download_multi_sizes,$multi_download_var;
  if (!function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
  }

  $convert_options = init_convert_options();
  $image_info = (defined("IN_CP")) ? getimagesize($file) : @getimagesize($file);
  if (!$image_info) {
    return false;
  }
  if ($resize_width==0){$resize_width=$image_info[0];}
  if ($resize_height==0){$resize_height=$image_info[1];}
  if ($multi_download_var['crop']){
$scale = max($resize_width/$image_info[0], $resize_height/$image_info[1]);
  }
  else{
$scale = min($resize_width/$image_info[0], $resize_height/$image_info[1]);
  }
$new_width = floor($scale*$image_info[0]);
$new_height = floor($scale*$image_info[1]);
$resize_handle = "resize_image_".$convert_options['convert_tool'];
if ((($scale == '1' || $scale == '0') && !$multi_download_var['crop']) || (($resize_width==$image_info[0]) && ($resize_height==$image_info[1]))){
return $file;
}
if (!$multi_download_var['crop']){
if($resize_handle($file, $new_file, $quality, $new_width, $new_height, $image_info)) {
@chmod($new_file, CHMOD_FILES);
return true;
}
else {
return false;
}
}
$crop_handle = "multi_download_resize_crop_image_".$convert_options['convert_tool'];
if ($resize_width == $new_width){
$multi_crop_st_w='0';
$multi_crop_end_w=$image_info['0'];
$multi_crop_end_h = (($image_info['0']*$resize_height)/$resize_width);
switch($multi_download_var['crop']){
case (2) :
$multi_crop_st_h= ($image_info['1']-$multi_crop_end_h);
break;
case (3) :
$multi_crop_st_h= '0';
break;
case (4) :
$multi_crop_st_h = '0';
$multi_crop_end_h = $image_info[1];
break;
case (1) :
default:
$multi_crop_st_h= (($image_info['1']-$multi_crop_end_h)/2);
break;
}
}
else{
$multi_crop_st_h='0';
$multi_crop_end_h=$image_info['1'];
$multi_crop_end_w = (($image_info['1']*$resize_width)/$resize_height);
switch($multi_download_var['crop']){
case (2) :
$multi_crop_st_w= ($image_info['0']-$multi_crop_end_w);
break;
case (3) :
$multi_crop_st_w= '0';
break;
case (4) :
$multi_crop_st_w = '0';
$multi_crop_end_w = $image_info[0];
break;
case (1) :
default:
$multi_crop_st_w = (($image_info['0']-$multi_crop_end_w)/2);
break;
}
}
if($crop_handle($file, $new_file, $quality, $resize_width, $resize_height, $image_info, $multi_crop_st_w,$multi_crop_st_h,$multi_crop_end_w,$multi_crop_end_h)) {
@chmod($new_file, CHMOD_FILES);
return true;
}
else {
return false;
}

}

function multi_download_resize_crop_image_gd($src, $dest, $quality, $width, $height, $image_info, $multi_crop_st_w, $multi_crop_st_h, $multi_crop_end_w, $multi_crop_end_h) {
  global $convert_options,$multi_download_var;

  $types = array(1 => "gif", 2 => "jpeg", 3 => "png");
  if ($convert_options['convert_gd2']) {
    $thumb = imagecreatetruecolor($width, $height);
  }
  else {
    $thumb = imagecreate($width, $height);
  }
  $image_create_handle = "imagecreatefrom".$types[$image_info[2]];
  if ($image = $image_create_handle($src)) {
    if ($convert_options['convert_gd2']) {
      imagecopyresampled($thumb, $image, 0, 0, $multi_crop_st_w,$multi_crop_st_h, $width, $height, $multi_crop_end_w, $multi_crop_end_h);
    }
    else {
      imagecopyresized($thumb, $image, 0, 0, $multi_crop_st_w,$multi_crop_st_h, $width, $height, $multi_crop_end_w, $multi_crop_end_h);
    }

    if ($image_info[2] == 3) {
      $quality = 9;
    }

    $image_handle = "image".$types[$image_info[2]];
    $image_handle($thumb, $dest, $quality);
    imagedestroy($image);
    imagedestroy($thumb);
  }
  return (file_exists($dest)) ? 1 : 0;
}

function multi_download_resize_crop_image_im($src, $dest, $quality, $width, $height, $image_info, $multi_crop_st_w, $multi_crop_st_h, $multi_crop_end_w, $multi_crop_end_h) {
  global $convert_options,$multi_download_var;
  if ($multi_download_var['crop']==4){
$command = $convert_options['convert_path'];
$command .= " \"$src\" -quality ".$quality." -antialias -geometry $width"."x"."$height! -profile '*' -unsharp 0.5x1 \"$dest\"";
  }
  else{
$command = $convert_options['convert_path'];
$command .= " \"$src\" -crop ".$multi_crop_end_w."X".$multi_crop_end_h."+".$multi_crop_st_w."+".$multi_crop_st_h;
$command .= " -quality ".$quality." -antialias -geometry $width"."x"."$height -profile '*' -unsharp 0.5x1 \"$dest\"";
  }
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}

function multi_download_resize_crop_image_netpbm($src, $dest, $quality, $width, $height, $image_info, $multi_crop_st_w,$multi_crop_st_h,$multi_crop_end_w,$multi_crop_end_h) {
  global $convert_options,$multi_download_var;

  $convert_path = $convert_options['convert_path'];
  $types = array(1 => "gif", 2 => "jpeg", 3 => "png");
  $target = ($width > $height) ? $width : $height;
  $command = $convert_path."/".check_executable($types[$image_info[2]]."topnm")." ".$src." | ";
  if ($multi_download_var['crop']==4){
$command .= $convert_path."/".check_executable("pnmscale")." --quiet -xsize=".$width." -ysize=".$height." | ";
  }
  else{
$command .= $convert_path."/".check_executable("pnmcut")."  --quiet ".$multi_crop_st_w." ".$multi_crop_st_h." ".$multi_crop_end_w." ".$multi_crop_end_h." | ";
$command .= $convert_path."/".check_executable("pnmscale")." --quiet -xysize ".$width." ".$height." | ";
  }
  if ($image_info[2] == 1) {
    $command .= $convert_path."/".check_executable("ppmquant")." 256 | " . $convert_path."/".check_executable("ppmtogif")." > ".$dest;
  }
  elseif ($image_info[2] == 3) {
    $command .= $convert_path."/".check_executable("pnmtopng")." > ".$dest;
  }
  else {
    $jpeg_exec = (file_exists($convert_path."/".check_executable("pnmtojpeg"))) ? check_executable("pnmtojpeg") : check_executable("ppmtojpeg");
    $command .= $convert_path."/".$jpeg_exec." --quality=".$quality." > ".$dest;
  }
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}

if (!function_exists('check_big_type')) {  
function check_big_type($file_name) {
global $config;
return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
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;
}
}

// END MOD multi download
this is the old insert that needs to be replaced if upgrading from beta to ver 2.0 or above
Code: [Select]
// MOD multi download
function multi_download_resize($file, $new_file, $quality, $resize_width, $resize_height) {
  global $convert_options;
  if (!function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
  }
  $convert_options = init_convert_options();
  $image_info = (defined("IN_CP")) ? getimagesize($file) : @getimagesize($file);
  if (!$image_info) {
    return false;
  }
$scale = min($resize_width/$image_info[0], $resize_height/$image_info[1]);
$new_width = floor($scale*$image_info[0]);
$new_height = floor($scale*$image_info[1]);
$resize_handle = "resize_image_".$convert_options['convert_tool'];
if ($scale == '1'){
return $file;
}
elseif($resize_handle($file, $new_file, $quality, $new_width, $new_height, $image_info)) {
@chmod($new_file, CHMOD_FILES);
return true;
}
else {
return false;
}
}
// END MOD multi download

in the lang\english\admin.php file

look for
Code: [Select]
?>insert before (updated insert for ver 2.0)
Code: [Select]
//MOD multi downloads
$lang['multi_option'] = "Would you like to use multi-size download option for this category?";
$multi_download_optionlist = array(
  "0"  => "No",
  "1"  => "Yes, Allow all sizes to be selectable",
  "2"  => "Yes, Only allow smaller sizes then original to be selectable"
);
//END MOD multi downloads
original insert that needs to be replaced if upgrading from beta to ver 2.0
Code: [Select]
//MOD Multi Downloads
$lang['multi_option'] = "Are you using multi download option for this category?"
//END MOD Multi Downloads

in the lang\english\main.php file

look for
Code: [Select]
?>insert before (updated insert for version 2.1) (updated for ver 4.0)
Code: [Select]
// MOD multi download
$lang['download'] = "Download";
$lang['multi_select'] = "Select Size to Download";
$lang['original_size'] = "Original Size";
$lang['multi_resolution'] = "Your Screen Resolution is : ";
$lang['multi_down_group1'] = "4:3 Display";//create an entry for each one or your groups from the global.php file in this manor
$lang['multi_down_group2'] = "16:9 Display";
$lang['multi_down_group3'] = "16:10 Display";
$lang['multi_down_group4'] = "Mobile";
$lang['multi_down_group5'] = "Blackberry";
// END MOD multi download

in the template\your template\details.html file
the fun part.
my file I had something like this...
Code: [Select]
{lightbox_button}&nbsp;&nbsp;{postcard_button}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}I replaced this with
Code: [Select]
{lightbox_button}&nbsp;&nbsp;{postcard_button}{if not_multi_download}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{download_button}&nbsp;&nbsp;{download_zip_button}
{endif not_multi_download}
<!-- Mod multi downloads -->
{if yes_multi_download}
{multi_download_options}
{endif yes_multi_download}
<!-- end mod-->

what you are trying to do is to remove the download and zip buttons if you are using the multi download and display the multi download option instead.
different templates may be setup differently.

(New to version 4.4)
To create the template used for the popup window...
Create a file in your templates folder and call it "multi_popup.html"
Copy the following code into that file and save the file
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{direction}">
<head>
<title>{prepend_head_title}{site_name}</title>
<meta http-equiv="content-type" content="text/html; charset={charset}">
<meta name="description" content="{detail_meta_description}{site_name}">
<meta name="keywords" content="{detail_meta_keywords}">
</head>
<body>
<img src="{img_url}"></img>
</body>
</html>

and you should be ready to go.
Title: Re: [BETA MOD] Multi Download of same image
Post by: Sunny C. on September 17, 2008, 01:28:21 AM
NICE Mod!!!!
Title: Re: [BETA MOD] Multi Download of same image
Post by: rinaldos on September 17, 2008, 10:14:21 PM
Wonderfull MOD, works fine with 1.76 :-)
Thank you for posting:-)

Ingo
Title: Re: [BETA MOD] Multi Download of same image
Post by: mawenzi on September 17, 2008, 10:27:12 PM
... no one with problems ... ;)
... so I moved it to Mods & Plugins (Releases & Support) ...
Title: Re: [MOD] Multi Download of same image
Post by: satine88 on September 26, 2008, 06:26:17 PM
Hello,
Does this mod resize the image to the desired size?
Title: Re: [MOD] Multi Download of same image
Post by: budduke on September 26, 2008, 08:35:50 PM
No, this mod does not change your original file at all.
it creates a new file at the size that you user is wanting to download from your site.
Creating a new file with a __resized_1024X768.jpg attached to the original name.

look for this line in the code above
$download_multi_sizes= array

the information there will tell you how to modify it to suit your site and sizes.

Let me know if that is not what you are asking...
Title: Re: [MOD] Multi Download of same image
Post by: batu544 on September 26, 2008, 09:27:17 PM
Wow !!! This is the MOD I was looking for..  :)  Here I have one question before putting this in my website ..

If I have an image of size 1024x768  and the user selected to download 1280x960 or bigger size , then what will happen ??


Thanks


Just tested this in my test server..  but I got the following error.

Fatal error: Call to undefined function check_big_type() in C:\wamp\www\bhwallpaers\includes\functions.php on line 215

I am using 1.7.4 version and also NOT using BIG mod..   :(


Title: Re: [MOD] Multi Download of same image
Post by: budduke on September 27, 2008, 12:48:02 AM
Wow !!! This is the MOD I was looking for..  :)  Here I have one question before putting this in my website ..

If I have an image of size 1024x768  and the user selected to download 1280x960 or bigger size , then what will happen ??


Thanks


Just tested this in my test server..  but I got the following error.

Fatal error: Call to undefined function check_big_type() in C:\wamp\www\bhwallpaers\includes\functions.php on line 215

I am using 1.7.4 version and also NOT using BIG mod..   :(




I have some wallpapers that are 800X600 and when it makes them 1280x960 or larger they look blurry, just like if you blow them up in you graphics program. that is why you should have the largest size possible and let it downsize to keep the quality.
but it does make it bigger just not as good of quality.

your error,check_big_type() , I do not see that in my functions.php file anywhere. Can you PM the file to me or post your functions.php so I can take a closer look at it? I do not have 1.7.4 to compare it with...
I did a quick search for that function and it looks like you are using either one of these mods...
http://www.4homepages.de/forum/index.php?topic=3236.0 (http://www.4homepages.de/forum/index.php?topic=3236.0)
or
http://www.4homepages.de/forum/index.php?topic=8018.0 (http://www.4homepages.de/forum/index.php?topic=8018.0)

is this mod working ok before you added my mod?
If you can send me the functions file I will see if maybe something got placed in the wrong spot when you was inserting some of the code.

Title: Re: [MOD] Multi Download of same image
Post by: batu544 on September 28, 2008, 04:51:03 PM
HI,
    Sorry for late reply ...   Its sunday here .. :)  As far as I can remember .. I have not install the MOD's mentioned by you. Here I am posting my functions.php  file .. Please look into it and let me know if I have done some mistake.

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: functions.php                                        *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.4                                                *
 *                                                                        *
 *    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.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}
// MOD ADDED TO GET DIFFERENT DETAIL PAGE STARTS HERE
function get_cat_template($tpl_name$cat_id 0) {
  global 
$cat_cache;
  if (!
$cat_id) {
    
$new_tpl_name $tpl_name;
  }
  elseif (
file_exists(TEMPLATE_PATH."/".$tpl_name."_".$cat_id.".html")) {
    
$new_tpl_name $tpl_name."_".$cat_id;
  }
  else {
    
$new_tpl_name get_cat_template($tpl_name$cat_cache[$cat_id]['cat_parent_id']);
  }
  return 
$new_tpl_name;
}
// MOD ADDED TO GET DIFFERENT DETAIL PAGE ENDS HERE

function set_download_token($token) {
  global 
$site_sess$user_info;

  if (
$user_info['user_level'] == ADMIN) {
    return;
  }

  
$download_token = @unserialize($site_sess->get_session_var('download_token'));

  if (!
$download_token) {
    
$download_token = array();
  }

  
$download_token[serialize(md5($token))] = 1;

  
$site_sess->set_session_var('download_token'serialize($download_token));
}

function 
clear_download_token($token) {
  global 
$site_sess$user_info;

  if (
$user_info['user_level'] == ADMIN) {
    return;
  }

  
$download_token = @unserialize($site_sess->get_session_var('download_token'));

  if (!
$download_token) {
    return;
  }

  
$token serialize(md5($token));

  if (isset(
$download_token[$token])) {
    unset(
$download_token[$token]);
    
$site_sess->set_session_var('download_token'serialize($download_token));
  }
}

function 
check_download_token($token) {
  global 
$site_sess$user_info;

  if (
$user_info['user_level'] == ADMIN) {
    return 
true;
  }

  
$download_token = @unserialize($site_sess->get_session_var('download_token'));

  if (isset(
$download_token[serialize(md5($token))])) {
    return 
true;
  }

  return 
false;
}

function 
get_gallery_image($image_name) {
  global 
$config;
  if (
file_exists(TEMPLATE_PATH."/images_".$config['language_dir']."/".$image_name)) {
    return 
TEMPLATE_PATH."/images_".$config['language_dir']."/".$image_name;
  }
  else {
    return 
TEMPLATE_PATH."/images/".$image_name;
  }
}

function 
get_basename($path) {
  
$path str_replace("\\""/"$path);
  
$name substr(strrchr($path"/"), 1);
  return 
$name $name $path;
}

function 
get_basefile($path) {
  
$basename get_basename($path);
  
ereg("(.+)\?(.+)"$basename$regs);
  return isset(
$regs[1]) ? $regs[1] : $basename;
}

function 
redirect($url) {
  global 
$script_url$site_sess;
  if (
strpos($url'://') === false) {
    
$url $script_url.'/'.$url;
  }
  
$location = @preg_match('/Microsoft|WebSTAR|Xitami/'getenv('SERVER_SOFTWARE')) ? 'Refresh: 0; URL=' 'Location: ';
  if (
is_object($site_sess)) {
    
$url $site_sess->url($url"&");
  }
  
header($location.$url);
  exit;
}

function 
is_remote($file_name) {
  return 
strpos($file_name'://') > 0;
}

function 
is_remote_file($file_name) {
  return 
is_remote($file_name) && preg_match("#\.[a-zA-Z0-9]{1,4}$#"$file_name) ? 0;
}

function 
is_local_file($file_name) {
  return !
is_remote($file_name) && get_basefile($file_name) != $file_name && preg_match("#\.[a-zA-Z0-9]{1,4}$#"$file_name) ? 0;
}

function 
check_remote_media($remote_media_file) {
  global 
$config;
  return 
is_remote($remote_media_file) && preg_match("#\.[".$config['allowed_mediatypes_match']."]+$#i"$remote_media_file) ? 0;
}

function 
check_local_media($local_media_file) {
  global 
$config;
  return !
is_remote($local_media_file) && get_basefile($local_media_file) != $local_media_file && preg_match("#\.[".$config['allowed_mediatypes_match']."]+$#i"$local_media_file) ? 0;
}

function 
check_remote_thumb($remote_thumb_file) {
  return 
is_remote($remote_thumb_file) && preg_match("#\.[gif|jpg|jpeg|png]+$#is"$remote_thumb_file) ? 0;
}

function 
check_local_thumb($local_thumb_file) {
  return !
is_remote($local_thumb_file) && get_basefile($local_thumb_file) != $local_thumb_file && preg_match("#\.[gif|jpg|jpeg|png]+$#i"$local_thumb_file) ? 0;
}

function 
get_file_extension($file_name) {
  
ereg("(.+)\.(.+)"get_basefile($file_name), $regs);
  return 
strtolower($regs[2]);
}

function 
get_file_name($file_name) {
  
ereg("(.+)\.(.+)"get_basefile($file_name), $regs);
  return 
$regs[1];
}

function 
check_media_type($file_name) {
  global 
$config;
  return (
in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 0;
}

function 
check_thumb_type($file_name) {
  return (
preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? 0;
}

function 
check_executable($file_name) {
  if (
substr(PHP_OS03) == "WIN" && !eregi("\.exe$"$file_name)) {
    
$file_name .= ".exe";
  }
  elseif (
substr(PHP_OS03) != "WIN") {
    
$file_name eregi_replace("\.exe$"""$file_name);
  }
  return 
$file_name;
}

function 
get_file_path($file_name ""$image_type "media"$cat_id 0$in_admin 0$return_icon 1$check_remote CHECK_REMOTE_FILES) {
  
$return_code = ($return_icon) ? ICON_PATH."/404.gif" 0;
  if (empty(
$file_name)) {
    return 
$return_code;
  }
  if (
is_remote($file_name)) {
    
$check_handle "check_remote_".$image_type;
    return (
$check_handle($file_name) && remote_file_exists($file_name$check_remote)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" $file_name) : $return_code;
  }
  elseif (
is_local_file($file_name)) {
    
$check_handle "check_local_".$image_type;
    
$file_name = ($in_admin && preg_match("/^([\.]+|[^\/])/"$file_name)) ? "../".$file_name $file_name;
    if (!
file_exists($file_name)) {
      
$file_path preg_replace("/\/{2,}/""/"get_document_root()."/".$file_name);
      return (
$check_handle($file_name) && file_exists($file_path)) ? (($in_admin && !preg_match("#(gif|jpg|jpeg|png)$#is"$file_name)) ? ICON_PATH."/".get_file_extension($file_name).".gif" $file_name) : $return_code;
    }
    else {
      return 
$file_name;
    }
  }
  else {
    
$check_handle "check_".$image_type."_type";
    
$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;
  }
}
function 
safe_htmlspecialchars($chars) {
  
// Translate all non-unicode entities
  
$chars preg_replace(
    
'/&(?!(#[0-9]+|[a-z]+);)/si',
    
'&amp;',
    
$chars
  
);

  
$chars str_replace(">""&gt;",   $chars);
  
$chars str_replace("<""&lt;",   $chars);
  
$chars str_replace('"'"&quot;"$chars);
  return 
$chars;
}

function 
un_htmlspecialchars($text) {
  
$text str_replace(
    array(
'&lt;''&gt;''&quot;''&amp;'),
    array(
'<',    '>',    '"',      '&'),
    
$text
  
);

  return 
$text;
}

function 
get_iptc_info($info) {
  
$iptc_match = array();
  
$iptc_match['2#120'] = "caption";
  
$iptc_match['2#122'] = "caption_writer";
  
$iptc_match['2#105'] = "headline";
  
$iptc_match['2#040'] = "special_instructions";
  
$iptc_match['2#080'] = "byline";
  
$iptc_match['2#085'] = "byline_title";
  
$iptc_match['2#110'] = "credit";
  
$iptc_match['2#115'] = "source";
  
$iptc_match['2#005'] = "object_name";
  
$iptc_match['2#055'] = "date_created";
  
$iptc_match['2#090'] = "city";
  
$iptc_match['2#095'] = "state";
  
$iptc_match['2#101'] = "country";
  
$iptc_match['2#103'] = "original_transmission_reference";
  
$iptc_match['2#015'] = "category";
  
$iptc_match['2#020'] = "supplemental_category";
  
$iptc_match['2#025'] = "keyword";
  
$iptc_match['2#116'] = "copyright_notice";

  
$iptc iptcparse($info);
  
$iptc_array = array();
  if (
is_array($iptc)) {
    foreach (
$iptc as $key => $val) {
      if (isset(
$iptc_match[$key])) {
        
$iptc_info "";
        foreach (
$val as $val2) {
          
$iptc_info .= (($iptc_info != "" ) ? ", " "").$val2;
        }
        if (
$key == "2#055") {
          
$iptc_array[$iptc_match[$key]] = preg_replace("/([0-9]{4})([0-9]{2})([0-9]{2})/""\\3.\\2.\\1"$iptc_info);
        }
        else {
          
$iptc_array[$iptc_match[$key]] = $iptc_info;
        }
      }
    }
  }
  return 
$iptc_array;
}

function 
get_exif_info($exif) {
  
$exif_match = array();
  
$exif_match['Make'] = "make";
  
$exif_match['Model'] = "model";
  
$exif_match['DateTimeOriginal'] = "datetime";
  
$exif_match['ISOSpeedRatings'] = "isospeed";
  
$exif_match['ExposureTime'] = "exposure";
  
$exif_match['FNumber'] = "aperture";
  
$exif_match['FocalLength'] = "focallen";

  
$exif_array = array();
  if (
is_array($exif)) {
    foreach (
$exif as $key => $val) {
      if (isset(
$exif_match[$key])) {
        
$exif_info $val;
        if (
$key == "DateTimeOriginal") {
          
$exif_array[$exif_match[$key]] = preg_replace("/([0-9]{4}):([0-9]{2}):([0-9]{2})/""\\3.\\2.\\1"$exif_info);
        }
        elseif (
$key == "ExposureTime") {
  $exposure explode("/"$exif_info);
          
$exif_array[$exif_match[$key]] = "1/" . ($exposure[1] / $exposure[0]);
        }
        elseif (
$key == "FNumber") {
  $aperture explode("/"$exif_info);
          
$exif_array[$exif_match[$key]] = "F/" . ($aperture[0] / $aperture[1]);
        }
        elseif (
$key == "FocalLength") {
  $focalLen explode("/"$exif_info);
          
$exif_array[$exif_match[$key]] = ($focalLen[0] / $focalLen[1]) . "mm";
        }
        else {
          
$exif_array[$exif_match[$key]] = $exif_info;
        }
      }
    }
  }
  return 
$exif_array;
}

function 
show_image($image_row$mode ""$show_link 1$detailed_view 0) {
  global 
$self_url$site_template$site_sess$user_info$config$cat_cache$lang$additional_image_fields$user_table_fields$url_show_profile$image_row_temp;
  global 
$multi_download_options_string;// MOD multi download
$image_row_temp $image_row;

  
$is_new = ($image_row['image_date'] >= (time() - 60 60 24 $config['new_cutoff'])) ? 0;
  
$description = (!empty($image_row['image_description'])) ? format_text($image_row['image_description'], 101) : REPLACE_EMPTY;

  if (!empty(
$image_row['image_keywords'])) {
    
$split_keywords explode(" "$image_row['image_keywords']);
    
$keywords "";
    foreach (
$split_keywords as $key => $val) {
      
$keywords .= (($keywords != "" ) ? ", " "")."<a href=\"".$site_sess->url(ROOT_PATH."search.php?search_keywords=".urlencode($val))."\">".format_text($val2)."</a>";
    }
  }
  else {
    
$keywords REPLACE_EMPTY;
  }

  if (!
check_permission("auth_readcomment"$image_row['cat_id'])) {
    
$image_row['image_allow_comments'] = 0;
  }

  
$num_comments = ($image_row['image_allow_comments'] == 1) ? $image_row['image_comments'] : "";

  if (
$user_info['user_level'] != GUEST) {
    
$lightbox_url $self_url;
    
$lightbox_url .= (!empty($mode)) ? ((strpos($lightbox_url'?') !== false) ? "&amp;" "?")."mode=".$mode "";
    
$lightbox_url .= strpos($lightbox_url'?') !== false "&amp;" "?";
    if (
check_lightbox($image_row['image_id'])) {
      
$lightbox_url .= "action=removefromlightbox&amp;id=".$image_row['image_id'];
      
$lightbox_button "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_yes.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
    else {
      
$lightbox_url .= "action=addtolightbox&amp;id=".$image_row['image_id'];
      
$lightbox_button "<a href=\"".$site_sess->url($lightbox_url)."\"><img src=\"".get_gallery_image("lightbox_no.gif")."\" border=\"0\" alt=\"\" /></a>";
    }
  }
  else {
    
$lightbox_button "<img src=\"".get_gallery_image("lightbox_off.gif")."\" border=\"0\" alt=\"\" />";
  }

  if (!
check_permission("auth_download"$image_row['cat_id'])) {
    
$download_button "<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
    
$download_zip_button = (function_exists("gzcompress") && function_exists("crc32")) ? "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" />" "";
    
$allow_download 0;
    
clear_download_token($image_row['image_id']);
  }
  else {
    
$target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']) && !is_local_file($image_row['image_download_url'])) ? "target=\"_blank\"" "";
    
$download_button "<a href=\"".$site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download.gif")."\" border=\"0\" alt=\"\" /></a>";
    
$download_zip_button = ($target == "" && function_exists("gzcompress") && function_exists("crc32")) ? "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=zip&amp;".URL_IMAGE_ID."=".$image_row['image_id'])."\"".$target."><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>" "";
    
$allow_download 1;
    
set_download_token($image_row['image_id']);
  }

// MOD multi download

if (!check_permission("auth_download"$image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_options $multi_download_options_string;
    
$multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
                   </TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
                    <input type='hidden' name='image_id' value='"
.$image_row['image_id']."' /></form>";
//
$allow_download 1;
    
set_download_token($image_row['image_id']);

}
$site_template->register_vars("multi_download_options"$multi_download_options);
// END MOD multi download

  
if (!check_permission("auth_sendpostcard"$image_row['cat_id'])) {
    
$postcard_button "<img src=\"".get_gallery_image("postcard_off.gif")."\" border=\"0\" alt=\"\" />";
  }
  else {
    
$postcard_button "<a href=\"".$site_sess->url(ROOT_PATH."postcards.php?".URL_IMAGE_ID."=".$image_row['image_id'].((!empty($mode)) ? "&amp;mode=".$mode ""))."\"><img src=\"".get_gallery_image("postcard.gif")."\" border=\"0\" alt=\"\" /></a>";
  }

  if (!
check_permission("auth_viewimage"$image_row['cat_id']) || !check_permission("auth_viewcat"$image_row['cat_id'])) {
    
$show_link 0;
  }

  
$file_size "n/a";
  if (!
is_remote($image_row['image_media_file'])) {
    if (
$file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      
$file_size format_file_size($file_size);
    }
  }
  elseif (
$detailed_view) {
    
$file_size get_remote_file_size($image_row['image_media_file']);
  }

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

    
$user_profile_link = (!empty($url_show_profile)) ? str_replace("{user_id}"$image_row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$image_row['user_id'];
    
$user_name_link "<a href=\"".$site_sess->url($user_profile_link)."\">".$user_name."</a>";
  }
  else {
    
$user_name format_text($lang['userlevel_guest'], 2);
    
$user_name_link $user_name;
  }

  
$site_template->register_vars(array(
    
"image_id" => $image_row['image_id'],
    
"user_id" => $image_row['user_id'],
    
"user_name" => $user_name,
    
"user_name_link" => $user_name_link,
    
"image_name" => format_text($image_row['image_name'], 2),
    
"image_description" => $description,
    
"image_keywords" => $keywords,
    
"image_date" => format_date($config['date_format']." ".$config['time_format'],$image_row['image_date']),
    
"image_is_new" => $is_new,
    
"lang_new" => $lang['new'],
    
"image_active" => $image_row['image_active'],
    
"cat_id" => $image_row['cat_id'],
    
"cat_name" => format_text($image_row['cat_name'], 2),
    
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$image_row['cat_id']),
    
"image_downloads" => $image_row['image_downloads'],
    
"image_votes" => $image_row['image_votes'],
    
"image_rating" => $image_row['image_rating'],
    
"image_hits" => $image_row['image_hits'],
    
"allow_comments" => $image_row['image_allow_comments'],
    
"lang_comments" => $lang['comments'],
    
"image_comments" => $num_comments,
    
"lightbox_button" => $lightbox_button,
    
"postcard_button" => $postcard_button,
    
"download_button" => $download_button,
    
"download_zip_button" => $download_zip_button,
    
"image_download_url" => $image_row['image_download_url'],
    
"allow_download" => $allow_download,
    
"url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),
    
"image_file_size" => $file_size,
    
"image_url" => ($show_link) ? $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_row['image_id'].((!empty($mode)) ? "&amp;mode=".$mode "")) : "",
    
"image" => 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),
    
"thumbnail" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link),
    
"thumbnail_openwindow" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode$show_link1),
    
"image_file_name" => $image_row['image_media_file'],
    
"thumbnail_file_name" => $image_row['image_thumb_file']
  ));

  if (!empty(
$additional_image_fields)) {
    
$additional_field_array = array();
    foreach (
$additional_image_fields as $key => $val) {
      
$additional_field_array[$key] = (!empty($image_row[$key])) ? format_text($image_row[$key], 1) : REPLACE_EMPTY;
      
$additional_field_array['lang_'.$key] = $val[0];
    }
    if (!empty(
$additional_field_array)) {
      
$site_template->register_vars($additional_field_array);
    }
  }

  
$rate_form "";
  if (
check_permission("auth_vote"$image_row['cat_id'])) {
    
$site_template->register_vars("rate"$lang['rate']);
    
$rate_form $site_template->parse_template("rate_form");
  }
  
$site_template->register_vars("rate_form"$rate_form);
  return 
true;
}

/******************** original code commented for popup

function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {
  global $site_sess, $config;

  if (!check_media_type($media_file_name)) {
    $thumb = "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!get_file_path($thumb_file_name, "thumb", $cat_id, 0, 0)) {
      $file_src = ICON_PATH."/".get_file_extension($media_file_name).".gif";
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      $file_src = get_file_path($thumb_file_name, "thumb", $cat_id, 0, 1);
      $image_info = @getimagesize($file_src);
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";
      $thumb = "<img src=\"".$file_src."\" border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
    }
  }

  if ($show_link) {
    if ($open_window) {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\">".$thumb."</a>";
    }
    else {
      $thumb = "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode : ""))."\">".$thumb."</a>";
    }
  }
  return $thumb;
}
   Original code commented for popup
****************/
function get_thumbnail_code($media_file_name$thumb_file_name ""$image_id$cat_id$image_name ""$mode ""$show_link 1$open_window 0) {
  global 
$site_sess$config$lang;;

  if (!
check_media_type($media_file_name)) {
    
$thumb "<img ".(($show_link) ? "" "onClick=\"alert('".$lang['members_only']."');\"")."src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
  }
  else {
    if (!
get_file_path($thumb_file_name"thumb"$cat_id00)) {
      
$file_src ICON_PATH."/".get_file_extension($media_file_name).".gif";
      
$image_info = @getimagesize($dummy);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";

      
$thumb "<img src=\"".$file_src."\" ".(($show_link) ? "" "onClick=\"alert('".$lang['members_only']."'); \"")."border=\"0\"".$width_height." alt=\"".$image_name."\" />";
    }
    else {
      
$file_src get_file_path($thumb_file_name"thumb"$cat_id01);
      
$image_info = @getimagesize($file_src);
      
$width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";

global $image_row_temp;
if (!terms_check($cat_id, (($image_row_temp['terms']) ? $image_row_temp "")))
{
$file_src "thumb.php?file=".urlencode(str_replace(THUMB_DIR."/"""$file_src))."&folder=blur";
$thumb "<img src=\"".$file_src."\" ".(($show_link) ? "" "onClick=\"alert('".$lang['members_only']."'); \"")."border=\"".$config['image_border']."\"".$width_height." class=\"reflect rheight33 ropacity20\" alt=\"".$image_name."\" />";
}
else
{
$thumb "<img src=\"".$file_src."\" ".(($show_link) ? "" "onClick=\"alert('".$lang['members_only']."'); \"")."border=\"".$config['image_border']."\"".$width_height." class=\"reflect rheight33 ropacity20\" alt=\"".$image_name."\" />";
}
//    global $site_db;
//    $sql = "SELECT terms
//              FROM ".IMAGES_TABLE."
//              WHERE image_id = $image_id";
//    $result=$site_db->query($sql);
//    $row = $site_db->fetch_array($result);
//    $terms1 = $row['terms'];

//   if ($terms1['terms'] == 2) {

//  $file_src = "thumb.php?file=".urlencode(str_replace(THUMB_DIR."/", "", $file_src))."&folder=blur";
//  $thumb = "<img src=\"".$file_src."\" ".(($show_link) ? "" : "onClick=\"alert('".$lang['members_only']."'); \"")."border=\"".$config['image_border']."\"".$width_height." alt=\"".$image_name."\" />";
//     $thumb = "<img src=\"./data/thumbnails/test.jpg\" />";

//   }
//   else {
//   $thumb = "<img src=\"".$file_src."\" ".(($show_link) ? "" : "onClick=\"alert('".$lang['members_only']."'); \"")."border=\"".$config['image_border']."\"".$width_height." class=\"reflect rheight33 ropacity20\" alt=\"".$image_name."\" />";
//   }

    
}
  }

  if (
$show_link) {
    if (
$open_window) {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\" onclick=\"opendetailwindow()\" target=\"detailwindow\" scrollbars=\"yes\" top=\"0\" screenY=\"0\" left=\"0\" screenx=\"0\" width=\"1012\" height=\"732\">".$thumb."</a>";
    }
    else {
      
$thumb "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\">".$thumb."</a>";
    }
  }
  return 
$thumb;
}

function 
get_media_code($media_file_name$image_id 0$cat_id 0$image_name ""$mode ""$show_link 0$detailed_view 0) {
  global 
$site_template$site_sess$lang$mode;

  if (!
get_file_path($media_file_name"media"$cat_id00)) {
    
$media "<img src=\"".ICON_PATH."/404.gif\" border=\"0\" alt=\"\" />";
    
$site_template->register_vars("iptc_info""");
    
$site_template->register_vars("exif_info""");
  }
  else {
    
$media_src get_file_path($media_file_name"media"$cat_id01);
    
$media_src1 ROOT_PATH."image.php?w=650&img=".get_file_path($media_file_name"media"$cat_id01);
//    echo "$media_src1";
    
$file_extension get_file_extension($media_file_name);
    
$media_icon "<img src=\"".ICON_PATH."/".$file_extension.".gif\" border=\"0\" alt=\"".$image_name."\" />";
    if (
$show_link) {
      
$media_icon "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&amp;mode=".$mode ""))."\">".$media_icon."</a>";
    }
    
$width_height "";
    
$width "";
    
$height "";
    
$iptc_info "";
    
$exif_info "";
    if (!
is_remote($media_src)) {
      
$src = (!file_exists($media_src) && file_exists(preg_replace("/\/{2,}/""/"get_document_root()."/".$media_src))) ? preg_replace("/\/{2,}/""/"get_document_root()."/".$media_src) : $media_src;
      if (
$image_info = @getimagesize($src$info)) {
        
$width_height " ".$image_info[3];
        
$width $image_info[0];
        
$height $image_info[1];
        if (
$detailed_view && isset($info['APP13'])) {
          
$iptc_array get_iptc_info($info['APP13']);
          
$bgcounter 0;
          foreach (
$iptc_array as $key => $val) {
            
$row_bg_number = ($bgcounter++ % == 0) ? 2;
            
$site_template->register_vars(array(
              
"iptc_value" => format_text($val),
              
"iptc_name" => $lang['iptc_'.$key],
              
"row_bg_number" => $row_bg_number
            
));
            
$iptc_info .= $site_template->parse_template("iptc_bit");
          }
        }
        if (
$detailed_view && $image_info[2] == && function_exists('exif_read_data') && $exif_data = @exif_read_data($src'EXIF')) {
          
$exif_array get_exif_info($exif_data);
          
$bgcounter 0;
          foreach (
$exif_array as $key => $val) {
            
$row_bg_number = ($bgcounter++ % == 0) ? 2;
            
$site_template->register_vars(array(
              
"exif_value" => format_text($val),
              
"exif_name" => $lang['exif_'.$key],
              
"row_bg_number" => $row_bg_number
            
));
            
$exif_info .= $site_template->parse_template("exif_bit");
          }
        }
      }
    }
    
$site_template->register_vars(array(
      
"media_src" => $media_src,
      
"media_src1" => $media_src1,
      
"media_icon" => $media_icon,
      
"image_name" => $image_name,
      
"width_height" => $width_height,
      
"width" => $width,
      
"height" => $height,
      
"iptc_info" => $iptc_info,
      
"exif_info" => $exif_info
    
));
    
$media $site_template->parse_template("media/".$file_extension);
  }
  return 
$media;
}

function 
get_random_image_cache() {
  global 
$site_db$cat_cache$total_images;

  
$random_image_cache = array();
  
$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");

  if (
SHOW_RANDOM_CAT_IMAGE) {
    
$sql "SELECT DISTINCT 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, 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 NOT IN (
$cat_id_sql) AND c.cat_id = i.cat_id
            ORDER BY RAND()"
;
    
$result $site_db->query($sql);
    while (
$row $site_db->fetch_array($result)) {
      
$random_image_cache[$row['cat_id']] = $row;
    }
  }
  else {
    if (empty(
$total_images)) {
      
$sql "SELECT COUNT(*) as total_images
              FROM "
.IMAGES_TABLE."
              WHERE image_active = 1 AND cat_id NOT IN (
$cat_id_sql)";
      
$row $site_db->query_firstrow($sql);
      
$total_images $row['total_images'];
    }
    if (empty(
$total_images)) {
      return 
$random_image_cache;
    }
    
mt_srand((double)microtime() * 1000000);
    
$number = ($total_images 1) ? mt_rand(0$total_images 1) : 0;

    
$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, 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 NOT IN (
$cat_id_sql) AND c.cat_id = i.cat_id
            LIMIT 
$number, 1";
    
$random_image_cache[0] = $site_db->query_firstrow($sql);
  }
  return 
$random_image_cache;
}

function 
get_random_image($cat_id 0$show_link 1$return_file 0) {
  global 
$site_template$random_image_cache;

  if (!isset(
$random_image_cache)) {
    
$random_image_cache get_random_image_cache();
  }

  if (
$cat_id && SHOW_RANDOM_CAT_IMAGE) {
    
$template 'random_cat_image';
    
$category_id $cat_id;
  }
  else {
    
$template 'random_image';
    if (
SHOW_RANDOM_CAT_IMAGE) {
      
srand((float)microtime() * 1000000);
      
$category_id array_rand($random_image_cache);
    }
    else {
      
$category_id 0;
    }
  }

  if (!empty(
$random_image_cache[$category_id])) {
    if (!
$return_file) {
      
show_image($random_image_cache[$category_id], ""$show_link);
      
$random_image $site_template->parse_template($template);
      return 
$random_image;
    }
    else {
      return 
get_file_path($random_image_cache[$category_id]['image_thumb_file'], "thumb"$category_id01);
    }
  }
}

function 
format_file_size($file_size 0) {
  
//$file_size = intval($file_size);
  
if (!$file_size) {
    return 
"n/a";
  }
  if (
strlen($file_size) <= && strlen($file_size) >= 7) {
    
$file_size number_format($file_size 1048576,1);
    return 
$file_size."&nbsp;MB";
  }
  elseif (
strlen($file_size) >= 10) {
    
$file_size number_format($file_size 1073741824,1);
    return 
$file_size."&nbsp;GB";
  }
  else {
    
$file_size number_format($file_size 1024,1);
    return 
$file_size."&nbsp;KB";
  }
}

function 
get_remote_file_size($file_path) {
  if (!
CHECK_REMOTE_FILES) {
    return 
'n/a';
  }
  
ob_start();
  @
readfile($file_path);
  
$file_data ob_get_contents();
  
ob_end_clean();
  return 
format_file_size(strlen($file_data));
}

function 
update_comment_count($image_id 0$user_id 0) {
  global 
$site_db$user_table_fields;
  if (
$image_id) {
    
$sql "SELECT COUNT(comment_id) AS comments
            FROM "
.COMMENTS_TABLE."
            WHERE image_id = 
$image_id";
    
$countcomments $site_db->query_firstrow($sql);
    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_comments = "
.$countcomments['comments']."
            WHERE image_id = 
$image_id";
    
$site_db->query($sql);
  }
  if (
$user_id != GUEST && $user_id && !empty($user_table_fields['user_comments'])) {
    
$sql "SELECT COUNT(comment_id) AS comments
            FROM "
.COMMENTS_TABLE."
            WHERE user_id = 
$user_id";
    
$countcomments $site_db->query_firstrow($sql);
    
$sql "UPDATE ".USERS_TABLE."
            SET "
.get_user_table_field("""user_comments")." = ".$countcomments['comments']."
            WHERE "
.get_user_table_field("""user_id")." = $user_id";
    
$site_db->query($sql);
  }
}

function 
update_image_rating($image_id$rating) {
  global 
$site_db;
  
$sql "SELECT cat_id, image_votes, image_rating
          FROM "
.IMAGES_TABLE."
          WHERE image_id = 
$image_id";
  
$image_row $site_db->query_firstrow($sql);
  if (
check_permission("auth_vote"$image_row['cat_id'])) {
    
$old_votes $image_row['image_votes'];
    
$old_rating $image_row['image_rating'];
    
$new_rating = (($old_rating $old_votes) + $rating) / ($old_votes 1);
    
$new_rating sprintf("%.2f"$new_rating);
    
$sql "UPDATE ".IMAGES_TABLE."
            SET image_votes = (
$old_votes + 1), image_rating = '$new_rating'
            WHERE image_id = 
$image_id";
    
$site_db->query($sql);
  }
}

function 
check_email($email) {
  return (
preg_match('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_`{|}~]+@([-0-9A-Z]+\.)+([0-9A-Z]){2,4}$/i'$email)) ? 0;
}

function 
format_date($format$timestamp) {
  global 
$user_info;
  
$timezone_offset = (defined("TIME_OFFSET")) ? TIME_OFFSET 0;
  return 
date($format$timestamp + (3600 $timezone_offset));
}

function 
format_url($url) {
  if (empty(
$url)) {
    return 
'';
  }

  if (!
preg_match("/^https?:\/\//i"$url)) {
    
$url "http://".$url;
  }

  return 
$url;
}

function 
replace_url($text) {
  
$text " ".$text." ";
  
$url_search_array = array(
    
"#([^]_a-z0-9-=\"'\/])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^, \(\)<>\n\r]*)?)#si",
    
"#([^]_a-z0-9-=\"'\/])([a-z]+?)://([^, \(\)<>\n\r]+)#si"
  
);

  
$url_replace_array = array(
    
"\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\" rel=\"nofollow\">www.\\2.\\3\\4</a>",
    
"\\1<a href=\"\\2://\\3\" target=\"_blank\" rel=\"nofollow\">\\2://\\3</a>",
  );
  
$text preg_replace($url_search_array$url_replace_array$text);

  if (
strpos($text"@")) {
    
$text preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i""\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>"$text);
  }
  return 
substr($text1, -1);
}

function 
replace_badwords($text) {
  global 
$config$split_badwords;
  if (
$config['badword_list'] != "") {
    if (!isset(
$split_badwords)) {
      
$badwords trim($config['badword_list']);
      
$badwords preg_replace("/[\n\r]/is"" "$badwords);
      
$badwords str_replace(","," ",$badwords);
      
$badwords preg_quote($badwords);
      
$badwords str_replace('/''\\/'$badwords);
      
$split_badwords preg_split("/\s+/"$badwords);
    }

    foreach (
$split_badwords as $key => $val) {
      if (
$val != "") {
        if (
substr($val02) == "\\{") {
          
$val substr($val2, -2);
          
$text trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si""\\1".str_repeat($config['badword_replace_char'], strlen($val)), $text "));
        }
        else {
          
$text trim(preg_replace("/$val/si"str_repeat($config['badword_replace_char'], strlen($val)), $text "));
        }
      }
    }
  }
  return 
$text;
}

function 
format_text($text$html 0$word_wrap 0$bbcode 0$bbcode_img 0) {
  if (
$word_wrap && $text != "") {
    
$text preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i"" \\1\n"$text);
  }

  if (
$html == || $html == 2) {
    
$text safe_htmlspecialchars($text);
  }

  if (
$html !== 2) {
    
$text nl2br(trim($text));
    
$text replace_url($text);
  }

  if (
$bbcode == 1) {
    
$search_array = array(
      
"/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU",
      
"/(\[)(list)(])(.*)(\[\/list\])/siU",
      
"/(\[\*\])/siU",
      
"/(\[\/\*\])/siU",
      
"/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
      
"/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
      
"/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU",
      
"/(\[)(url)(])([^\"]*)(\[\/url\])/siU",
      
"/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU",
      
"/javascript:/si",
      
"/about:/si"
    
);
    
$replace_array = array(
      
"<ol type=\"\\5\">\\7</ol>",
      
"<ul>\\4</ul>",
      
"<li>",
      
"</li>",
      
"<a href=\"http://www.\\6\" target=\"_blank\" rel=\"nofollow\">\\8</a>",
      
"<a href=\"\\5\" target=\"_blank\" rel=\"nofollow\">\\7</a>",
      
"<a href=\"http://www.\\5\" target=\"_blank\" rel=\"nofollow\">www.\\5</a>",
      
"<a href=\"\\4\" target=\"_blank\" rel=\"nofollow\">\\4</a>",
      
"<pre>Code:<hr size=1>\\5<hr size=1></pre>",
      
"java script:",
      
"about :"
    
);
    
$text preg_replace($search_array$replace_array$text);
    if (!
$bbcode_img)  {
      
$text preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU""<a href=\"\\5\" target=\"_blank\">\\5</a>"$text);
    }
    else  {
      
$text preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU""<img src=\"\\5\">"$text);
    }
    
$text preg_replace("/(\[)(b)(])(\r\n)*([^\"]*)(\[\/b\])/siU""<b>\\5</b>"$text);
    
$text preg_replace("/(\[)(i)(])(\r\n)*([^\"]*)(\[\/i\])/siU""<i>\\5</i>"$text);
    
$text preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU""<u>\\5</u>"$text);

    
$text replace_badwords($text);
  }

  
$text str_replace("\\'""'"$text);

  return 
$text;
}

function 
utf8_to_htmlentities($source) {
  
// array used to figure what number to decrement from character order
  // value
  // according to number of characters used to map unicode to ascii by
  // utf-8
  
$decrement = array();
  
$decrement[4] = 240;
  
$decrement[3] = 224;
  
$decrement[2] = 192;
  
$decrement[1] = 0;

  
// the number of bits to shift each charNum by
  
$shift = array();
  
$shift[1][0] = 0;
  
$shift[2][0] = 6;
  
$shift[2][1] = 0;
  
$shift[3][0] = 12;
  
$shift[3][1] = 6;
  
$shift[3][2] = 0;
  
$shift[4][0] = 18;
  
$shift[4][1] = 12;
  
$shift[4][2] = 6;
  
$shift[4][3] = 0;

  
$pos 0;
  
$len strlen($source);
  
$str '';
  while (
$pos $len) {
    
$asciiPos ord(substr($source$pos1));
    if ((
$asciiPos >= 240) && ($asciiPos <= 255)) {
      
// 4 chars representing one unicode character
      
$thisLetter substr($source$pos4);
      
$pos += 4;
    }
    elseif ((
$asciiPos >= 224) && ($asciiPos <= 239)) {
      
// 3 chars representing one unicode character
      
$thisLetter substr($source$pos3);
      
$pos += 3;
    }
    else if ((
$asciiPos >= 192) && ($asciiPos <= 223)) {
      
// 2 chars representing one unicode character
      
$thisLetter substr($source$pos2);
      
$pos += 2;
    }
    else {
      
// 1 char (lower ascii)
      
$thisLetter substr($source$pos1);
      
$pos += 1;
    }

    
// process the string representing the letter to a unicode entity
    
$thisLen strlen($thisLetter);
    
$thisPos 0;
    
$decimalCode 0;

    while (
$thisPos $thisLen) {
      
$thisCharOrd ord(substr($thisLetter$thisPos1));
      if (
$thisPos == 0) {
        
$charNum intval($thisCharOrd $decrement[$thisLen]);
        
$decimalCode += ($charNum << $shift[$thisLen][$thisPos]);
      } else {
        
$charNum intval($thisCharOrd 128);
        
$decimalCode += ($charNum << $shift[$thisLen][$thisPos]);
      }
      
$thisPos++;
    }
    if ((
$thisLen == 1) && ($decimalCode <= 128)) {
      
$encodedLetter $thisLetter;
    }
    else {
      
$encodedLetter '&#38;#' $decimalCode ';';
    }
    
$str .= $encodedLetter;
  }
  return 
$str;
}

function 
uni_to_utf8($char) {
  
$char intval($char);

  switch (
$char) {
    case (
$char 128) :
      
// its an ASCII char no encoding needed
      
return chr($char);

    case (
$char << 11) :
      
// its a 2 byte UTF-8 char
      
return chr(192 + ($char >> 6)) .
             
chr(128 + ($char 63));

    case (
$char << 16) :
      
// its a 3 byte UTF-8 char
      
return chr(224 + ($char >> 12)) .
             
chr(128 + (($char >> 6) & 63)) .
             
chr(128 + ($char 63));

    case (
$char << 21) :
      
// its a 4 byte UTF-8 char
      
return chr(240 + ($char >> 18)) .
             
chr(128 + (($char >> 12) & 63)) .
             
chr(128 + (($char >>  6) & 63)) .
             
chr(128 + ($char 63));

    case (
$char << 26) :
      
// its a 5 byte UTF-8 char
      
return chr(248 + ($char >> 24)) .
             
chr(128 + (($char >> 18) & 63)) .
             
chr(128 + (($char >> 12) & 63)) .
             
chr(128 + (($char >> 6) & 63)) .
             
chr(128 + ($char 63));
    default:
      
// its a 6 byte UTF-8 char
      
return chr(252 + ($char >> 30)) .
             
chr(128 + (($char >> 24) & 63)) .
             
chr(128 + (($char >> 18) & 63)) .
             
chr(128 + (($char >> 12) & 63)) .
             
chr(128 + (($char >> 6) & 63)) .
             
chr(128 + ($char 63));
  }
}

function 
get_user_info($user_id 0) {
  global 
$site_db$user_table_fields;
  
$user_info 0;
  if (
$user_id != && $user_id != GUEST) {
    
$sql "SELECT *
            FROM "
.USERS_TABLE."
            WHERE "
.get_user_table_field("""user_id")." = $user_id";
    if (
$user_info $site_db->query_firstrow($sql)) {
      foreach (
$user_table_fields as $key => $val) {
        if (isset(
$user_info[$val])) {
          
$user_info[$key] = $user_info[$val];
        }
        elseif (!isset(
$user_info[$key])) {
          
$user_info[$key] = "";
        }
      }
    }
  }
  return 
$user_info;
}

function 
get_icq_status($uin) {
  if (!
is_numeric($uin)) return false;

  
$fp = @fsockopen('status.icq.com'80$errno$errstr8);
  if (!
$fp) return false;

  
$request "HEAD /online.gif?icq=$uin&img=3 HTTP/1.0\r\n"
            
."Host: status.icq.com\r\n"
            
."Connection: close\r\n\r\n";
  
fputs($fp$request);

  do {
     
$response fgets($fp1024);
  }
  while (!
feof($fp) && !stristr($response'Location'));

  
fclose($fp);
  if (
strstr($response'online1')) return 'online';
  if (
strstr($response'online0')) return 'offline';
  if (
strstr($response'online2')) return 'disabled';
  return 
FALSE;
}

function 
add_to_lightbox($id) {
  global 
$user_info$site_db;
  
$id intval($id);
  if (!
$id) {
    return 
false;
  }
  
$lightbox_ids $user_info['lightbox_image_ids'];
  
$lightbox_array explode(" "$lightbox_ids);
  if (!
in_array($id$lightbox_array)) {
    
$lightbox_ids .= " ".$id;
  }
  
$user_info['lightbox_image_ids'] = trim($lightbox_ids);
  
$user_info['lightbox_lastaction'] = time();
  
$sql "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = "
.$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = "
.$user_info['user_id'];
  return (
$site_db->query($sql)) ? 0;
}

function 
remove_from_lightbox($id) {
  global 
$user_info$site_db;
  
$lightbox_array explode(" ",$user_info['lightbox_image_ids']);
  foreach (
$lightbox_array as $key => $val) {
    if (
$val == $id) {
      unset(
$lightbox_array[$key]);
    }
  }
  
$user_info['lightbox_image_ids'] = trim(implode(" "$lightbox_array));
  
$user_info['lightbox_lastaction'] = time();
  
$sql "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_lastaction = "
.$user_info['lightbox_lastaction'].", lightbox_image_ids = '".$user_info['lightbox_image_ids']."'
          WHERE user_id = "
.$user_info['user_id'];
  return (
$site_db->query($sql)) ? 0;
}

function 
clear_lightbox() {
  global 
$user_info$site_db;
  
$current_time time();
  
$sql "UPDATE ".LIGHTBOXES_TABLE."
          SET lightbox_image_ids = '', lightbox_lastaction = 
$current_time
          WHERE user_id = "
.$user_info['user_id'];
  if (
$site_db->query($sql)) {
    
$user_info['lightbox_image_ids'] = "";
    
$user_info['lightbox_lastaction'] = $current_time;
    return 
true;
  }
  else {
    return 
false;
  }
}

function 
check_lightbox($id) {
  global 
$user_info;
  
$lightbox_array explode(" "$user_info['lightbox_image_ids']);
  return 
in_array($id$lightbox_array);
}

function 
get_random_key($db_table ""$db_column "") {
  global 
$site_db;
  
$key md5(uniqid(microtime()));
  if (
$db_table != "" && $db_column != "") {
    
$i 0;
    while (
$i == 0) {
      
$sql "SELECT ".$db_column."
              FROM "
.$db_table."
              WHERE "
.$db_column." = '$key'";
      if (
$site_db->is_empty($sql)) {
        
$i 1;
      }
      else {
        
$i 0;
        
$key md5(uniqid(microtime()));
      }
    }
  }
  return 
$key;
}

function 
get_subcat_ids($cid 0$cat_id 0$cat_parent_cache) {
  global 
$subcat_ids;

  if (!isset(
$cat_parent_cache[$cid])) {
    return 
false;
  }
  foreach (
$cat_parent_cache[$cid] as $key => $val) {
    if (
check_permission("auth_viewcat"$val)) {
      
$subcat_ids[$cat_id][] = $val;
      
get_subcat_ids($val$cat_id$cat_parent_cache);
    }
  }
  return 
$subcat_ids;
}

function 
get_subcategories($parent_id) {
  global 
$cat_parent_cache$cat_cache$site_sess$config;

  if (!isset(
$cat_parent_cache[$parent_id]) || $config['num_subcats'] < 1) {
    return 
"";
  }

  
$visible_cat_cache = array();
  foreach (
$cat_parent_cache[$parent_id] as $key => $val) {
    if (
check_permission("auth_viewcat"$val)) {
      
$visible_cat_cache[$key] = $val;
    }
  }

  
$num_subs sizeof($visible_cat_cache);
  
$sub_cat_list "";
  
$i 1;
  foreach (
$visible_cat_cache as $subcat_id) {
    if (
$i <= $num_subs && $i <= $config['num_subcats']) {
      
$sub_url $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$subcat_id);
      
$sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";
      if (
$i != $config['num_subcats'] && $i $config['num_subcats'] && $i $num_subs) {
        
$sub_cat_list .= ", ";
      }
      if (
$i == $config['num_subcats'] && $i $num_subs) {
        
$sub_cat_list .= " ...\n";
      }
    }
    
$i++;
  }
  return 
$sub_cat_list;
}

function 
get_categories($cat_id 0) {
  global 
$site_template$site_db$site_sess$config$lang;
  global 
$cat_cache$cat_parent_cache$new_image_cache$subcat_ids;

  
$cattable_width ceil((intval($config['cat_table_width'])) / $config['cat_cells']);
  if ((
substr($config['cat_table_width'],-1)) == "%") {
    
$cattable_width .= "%";
  }

  if (!isset(
$cat_parent_cache[$cat_id])) {
    return 
"";
  }

  
$visible_cat_cache = array();
  foreach (
$cat_parent_cache[$cat_id] as $key => $val) {
    if (
check_permission("auth_viewcat"$val)) {
      
$visible_cat_cache[$key] = $val;
    }
  }

  if (empty(
$visible_cat_cache)) {
    return 
"";
  }

  
$total sizeof($visible_cat_cache);
  
$table_columns = (intval($config['cat_cells'])) ? intval($config['cat_cells']) : 2;
  if (
$total <= $table_columns) {
    
$table_rows 1;
  }
  else {
    
$table_rows $total $table_columns;
    if (
$total >= $table_columns && !is_integer($table_rows)) {
      
$table_rows intval($table_rows) + 1;
    }
  }

  
$categories "\n<table width=\"".$config['cat_table_width']."\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
  
$categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";
  
$count 0;
  
$count2 0;
  foreach (
$visible_cat_cache as $key => $category_id) {
    
$categories .= "<tr>\n<td valign=\"top\">\n";

    
$is_new = (isset($new_image_cache[$category_id]) && $new_image_cache[$category_id] > 0) ? 0;
    
$num_images = (isset($cat_cache[$category_id]['num_images'])) ? $cat_cache[$category_id]['num_images'] : 0;

    
$subcat_ids = array();
    
get_subcat_ids($category_id$category_id$cat_parent_cache);

    if (isset(
$subcat_ids[$category_id])) {
      foreach (
$subcat_ids[$category_id] as $val) {
        if (isset(
$new_image_cache[$val]) && $new_image_cache[$val] > 0) {
          
$is_new 1;
        }
        if (isset(
$cat_cache[$val]['num_images'])) {
          
$num_images += $cat_cache[$val]['num_images'];
        }
      }
    }

    if (
defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == || defined("SHOW_RANDOM_CAT_IMAGE") && SHOW_RANDOM_CAT_IMAGE == 0) {
      
$random_cat_image_file "";
    }
    else {
      
$random_cat_image_file get_random_image($category_id01);
    }

    
$site_template->register_vars(array(
      
"cat_id" => $category_id,
      
"cat_name" => format_text($cat_cache[$category_id]['cat_name'], 2),
      
"cat_description" => format_text($cat_cache[$category_id]['cat_description'], 1),
      
"cat_hits" => $cat_cache[$category_id]['cat_hits'],
      
"cat_is_new" => $is_new,
      
"lang_new" => $lang['new'],
      
"sub_cats" => get_subcategories($category_id),
      
"cat_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$category_id),
      
"random_cat_image_file" => $random_cat_image_file,
      
"num_images" => $num_images
    
));
    
$categories .= $site_template->parse_template("category_bit");
    
$count++;
    
$count2++;
    
$categories .= "</td>\n</tr>\n";

    if (
$count == $table_rows && $count2 sizeof($visible_cat_cache)) {
      
$categories .= "</table></td>\n";
      
$categories .= "<td valign=\"top\" width=\"".$cattable_width."\" class=\"catbgcolor\">\n";
      
$categories .= "<table border=\"0\" cellpadding=\"".$config['cat_table_cellpadding']."\" cellspacing=\"".$config['cat_table_cellspacing']."\">\n";

      
$total $total $count2;
      
$table_columns $table_columns 1;
      
/*if ($total <= $table_columns && $table_columns > 1) {
        $table_rows = 1;
      }
      else {
        $table_rows = $total / $table_columns;
        if ($total >= $table_columns && !is_integer($table_rows)) {
          $table_rows = intval($table_rows) + 1;
        }
      }*/
      
$count 0;
    }
  }

  
$categories .= "</table>\n</td>\n</tr>\n</table>\n";
  return 
$categories;
}

function 
get_category_path($cat_id 0$detail_path 0) {
  global 
$site_sess$config$cat_cache$url;
  
$parent_id 1;
  while (
$parent_id) {
    if (!isset(
$cat_cache[$cat_id]['cat_parent_id'])) {
      return 
false;
    }
    
$parent_id $cat_cache[$cat_id]['cat_parent_id'];

    if (empty(
$path)) {
      if (
$detail_path) {
        
$cat_url ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id;
        if (
preg_match("/".URL_PAGE."=([0-9]+)/"$url$regs)) {
          if (!empty(
$regs[1]) && $regs[1] != 1) {
            
$cat_url .= "&amp;".URL_PAGE."=".$regs[1];
          }
        }
        
$path "<a href=\"".$site_sess->url($cat_url)."\" class=\"clickstream\">".format_text($cat_cache[$cat_id]['cat_name'], 2)."</a>";
      }
      else  {
        
$path format_text($cat_cache[$cat_id]['cat_name'], 2);
      }
    }
    else {
      
$path "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\" class=\"clickstream\">".format_text($cat_cache[$cat_id]['cat_name'], 2)."</a>".$config['category_separator'].$path;
    }
    
$cat_id $parent_id;
  } 
// end while
  
return $path;
}

function 
get_category_path_nohtml($cat_id 0) {  // MOD: Dynamic page title
  
global $config$cat_cache;
  
$parent_id 1;
  while (
$parent_id) {
    if (!isset(
$cat_cache[$cat_id]['cat_parent_id'])) {
      return 
false;
    }
    
$parent_id $cat_cache[$cat_id]['cat_parent_id'];

    if (empty(
$path)) {
      
$path $cat_cache[$cat_id]['cat_name'];
    }
    else {
      
$path $cat_cache[$cat_id]['cat_name'].$config['category_separator'].$path;
    }
    
$cat_id $parent_id;
  } 
// end while
  
return $path;
}

function 
get_category_dropdown_bits($cat_id$cid 0$depth 1) {
  global 
$site_db$drop_down_cat_cache$cat_cache;

  if (!isset(
$drop_down_cat_cache[$cid])) {
    return 
"";
  }
  
$category_list "";
  foreach (
$drop_down_cat_cache[$cid] as $key => $category_id) {
    if (
check_permission("auth_viewcat"$category_id)) {
      
$category_list .= "<option value=\"".$category_id."\"";
      if (
$cat_id == $category_id) {
        
$category_list .= " selected=\"selected\"";
      }
      if (
$cat_cache[$category_id]['cat_parent_id'] == 0) {
        
$category_list .= " class=\"dropdownmarker\"";
      }

      if (
$depth 1) {
        
$category_list .= ">".str_repeat("--"$depth 1)." ".format_text($cat_cache[$category_id]['cat_name'], 2)."</option>\n";
      }
      else {
        
$category_list .= ">".format_text($cat_cache[$category_id]['cat_name'], 2)."</option>\n";
      }
      
$category_list .= get_category_dropdown_bits($cat_id$category_id$depth 1);
    }
  }
  unset(
$drop_down_cat_cache[$cid]);
  return 
$category_list;
}

function 
get_category_dropdown($cat_id$jump 0$admin 0$i 0) {
  global 
$lang$drop_down_cat_cache$cat_parent_cache;
  
// $admin = 1  Main Cat (update/add cats)
  // $admin = 2  All Cats (find/validate images...)
  // $admin = 3  Select Cat (update/add image)
  // $admin = 4  No Cat (check new images)

  
switch ($admin) {
  case 
1:
    
$category "\n<select name=\"cat_parent_id\" class=\"categoryselect\">\n";
    
$category .= "<option value=\"0\">".$lang['main_category']."</option>\n";
    
$category .= "<option value=\"0\">--------------</option>\n";
    break;

  case 
2:
    
$category "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
    
$category .= "<option value=\"0\">".$lang['all_categories']."</option>\n";
    
$category .= "<option value=\"0\">-------------------------------</option>\n";
    break;

  case 
3:
    
$i = ($i) ? "_".$i "";
    
$category "\n<select name=\"cat_id".$i."\" class=\"categoryselect\">\n";
    
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
    
$category .= "<option value=\"0\">-------------------------------</option>\n";
    break;

  case 
4:
    
$category "\n<select name=\"cat_id\" class=\"categoryselect\">\n";
    
$category .= "<option value=\"0\">".$lang['no_category']."</option>\n";
    
$category .= "<option value=\"0\">-------------------------------</option>\n";
    break;

  case 
0:
  default:
    if (
$jump) {
      
$category "\n<select name=\"".URL_CAT_ID."\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['jumpbox'].submit() }\" class=\"categoryselect\">\n";
    }
    else {
      
$category "\n<select name=\"".URL_CAT_ID."\" class=\"categoryselect\">\n";
    }
    
$category .= "<option value=\"0\">".$lang['select_category']."</option>\n";
    
$category .= "<option value=\"0\">-------------------------------</option>\n";
  } 
// end switch

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

function 
show_error_page($error_msg$clickstream "") {
  global 
$site_template$site_sess$lang$config;
  if (empty(
$clickstream)) {
    
$clickstream "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].$lang['error'];
  }
  
$site_template->register_vars(array(
    
"error_msg" => $error_msg,
    
"lang_error" => $lang['error'],
    
"clickstream" => $clickstream,
    
"random_image" => ""
  
));
  
// MOD: Dynamic page title BLOCK BEGIN
  
$header $site_template->parse_template("header");
  
$footer $site_template->parse_template("footer");
  
$site_template->register_vars(array(
    
"header" => $header,
    
"footer" => $footer
  
));
  unset(
$header);
  unset(
$footer);
  
// MOD: Dynamic page title BLOCK END
  
$site_template->print_template($site_template->parse_template("error"));
  exit;
}

function 
get_mysql_version() {
  global 
$global_info$site_db;
  if (!empty(
$global_info['mysql_version'])) {
    return 
$global_info['mysql_version'];
  }
  
$split_info = array();
  if (
$row $site_db->query_firstrow("SELECT VERSION() AS version")) {
    
$split_info explode('.'$row['version']);
  }
  else {
    if (
$row $site_db->query_firstrow("SHOW VARIABLES LIKE 'version'")){
      
$split_info explode('.'$row[1]);
    }
  }
  
$first  = (empty($split_info) || empty($split_info[0])) ? intval($split_info[0]);
  
$second = (empty($split_info[1])) ? 21 intval($split_info[1]);
  
$third  = (empty($split_info[2])) ? intval($split_info[2]);
  
$global_info['mysql_version'] = sprintf('%d%02d%02d'$first$second$third);
  return 
$global_info['mysql_version'];
}

function 
get_php_version() {
  global 
$global_info;
  if (!empty(
$global_info['php_version'])) {
    return 
$global_info['php_version'];
  }
  
$split_info = array();
  
preg_match("/([0-9]{1,2})\.([0-9]{1,2})(\.([0-9]{1,2}))?/"phpversion(), $split_info);

  
$global_info['php_version'] = 0;
  if (!empty(
$split_info) && !empty($split_info[1])) {
    
$first  intval($split_info[1]);
    
$second = (empty($split_info[2])) ? intval($split_info[2]);
    
$third  = (empty($split_info[4])) ? intval($split_info[4]);
    
$global_info['php_version'] = sprintf('%d%02d%02d'$first$second$third);
  }
  return 
$global_info['php_version'];
}

function 
get_user_os() {
  global 
$global_info$HTTP_USER_AGENT$HTTP_SERVER_VARS;
  if (!empty(
$global_info['user_os'])) {
    return 
$global_info['user_os'];
  }
  if (!empty(
$HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
    
$HTTP_USER_AGENT $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
  }
  elseif (
getenv("HTTP_USER_AGENT")) {
    
$HTTP_USER_AGENT getenv("HTTP_USER_AGENT");
  }
  elseif (empty(
$HTTP_USER_AGENT)) {
    
$HTTP_USER_AGENT "";
  }
  if (
eregi("Win"$HTTP_USER_AGENT)) {
    
$global_info['user_os'] = "WIN";
  }
  elseif (
eregi("Mac"$HTTP_USER_AGENT)) {
    
$global_info['user_os'] = "MAC";
  }
  else {
    
$global_info['user_os'] = "OTHER";
  }
  return 
$global_info['user_os'];
}

function 
get_browser_info() {
  global 
$global_info$HTTP_USER_AGENT$HTTP_SERVER_VARS;
  if (!empty(
$global_info['browser_agent'])) {
    return 
$global_info['browser_agent'];
  }
  if (!empty(
$HTTP_SERVER_VARS['HTTP_USER_AGENT'])) {
    
$HTTP_USER_AGENT $HTTP_SERVER_VARS['HTTP_USER_AGENT'];
  }
  elseif (
getenv("HTTP_USER_AGENT")) {
    
$HTTP_USER_AGENT getenv("HTTP_USER_AGENT");
  }
  elseif (empty(
$HTTP_USER_AGENT)) {
    
$HTTP_USER_AGENT "";
  }
  if (
eregi("MSIE ([0-9].[0-9]{1,2})"$HTTP_USER_AGENT$regs)) {
    
$global_info['browser_agent'] = "MSIE";
    
$global_info['browser_version'] = $regs[1];
  }
  elseif (
eregi("Mozilla/([0-9].[0-9]{1,2})"$HTTP_USER_AGENT$regs)) {
    
$global_info['browser_agent'] = "MOZILLA";
    
$global_info['browser_version'] = $regs[1];
  }
  elseif (
eregi("Opera(/| )([0-9].[0-9]{1,2})"$HTTP_USER_AGENT$regs)) {
    
$global_info['browser_agent'] = "OPERA";
    
$global_info['browser_version'] = $regs[2];
  }
  else {
    
$global_info['browser_agent'] = "OTHER";
    
$global_info['browser_version'] = 0;
  }
  return 
$global_info['browser_agent'];
}

function 
get_document_root() {
  global 
$global_info$DOCUMENT_ROOT$HTTP_SERVER_VARS;
  if (!empty(
$global_info['document_root'])) {
    return 
$global_info['document_root'];
  }
  if (!empty(
$HTTP_SERVER_VARS['DOCUMENT_ROOT'])) {
    
$DOCUMENT_ROOT $HTTP_SERVER_VARS['DOCUMENT_ROOT'];
  }
  elseif (
getenv("DOCUMENT_ROOT")) {
    
$DOCUMENT_ROOT getenv("DOCUMENT_ROOT");
  }
  elseif (empty(
$DOCUMENT_ROOT)) {
    
$DOCUMENT_ROOT "";
  }
  return 
$global_info['document_root'] = $DOCUMENT_ROOT;
}

function 
remote_file_exists($url$check_remote CHECK_REMOTE_FILES) { // similar to file_exists(), checks existence of remote files
  
if (!$check_remote || !CHECK_REMOTE_FILES) {
    return 
true;
  }
  
$url trim($url);
  if (!
preg_match("=://="$url)) $url "http://$url";
  if (!(
$url = @parse_url($url))) {
    return 
false;
  }
  if (!
eregi("http"$url['scheme'])) {
    return 
false;
  }
  
$url['port'] = (!isset($url['port'])) ? 80 $url['port'];
  
$url['path'] = (!isset($url['path'])) ? "/" $url['path'];
  
$fp fsockopen($url['host'], $url['port'], $errno$errstr30);
  if (!
$fp) {
    return 
false;
  }
  else {
    
$head "";
    
$httpRequest "HEAD ".$url['path']." HTTP/1.1\r\n"
                  
."HOST: ".$url['host']."\r\n"
                  
."Connection: close\r\n\r\n";
    
fputs($fp$httpRequest);
    while (!
feof($fp)) {
      
$head .= fgets($fp1024);
    }
    
fclose($fp);

    
preg_match("=^(HTTP/\d+\.\d+) (\d{3}) ([^\r\n]*)="$head$matches);
    if (
$matches[2] == 200) {
      return 
true;
    }
  }
}

if (!
function_exists('is_executable')) {
  function 
is_executable($file) {
    return 
is_file($file);
  }
}

if (!
function_exists('session_regenerate_id')) {
  function 
session_regenerate_id() {
   
$id md5(uniqid(microtime()));
   if (
session_id($id)) {
     return 
true;
   } else {
     return 
false;
   }
  }
}

function 
get_mime_content_type($file) {
    if (
function_exists('mime_content_type')) {
      
$type mime_content_type($file);
      if (
$type) {
        return 
$type;
      }
    }

    
$info = @getimagesize($file);

    if (isset(
$info['mime'])) {
      return 
$info['mime'];
    }

    
$type = @exec(trim('file -bi '.escapeshellarg($file)));

    if (
strpos($type';') !== false) {
      list(
$type) = explode(';'$type);
    }

    if (
$type) {
      return 
$type;
    }

    static 
$types = array(
      
'ai' => 'application/postscript',
     
'aif' => 'audio/x-aiff',
    
'aifc' => 'audio/x-aiff',
    
'aiff' => 'audio/x-aiff',
     
'asc' => 'text/plain',
      
'au' => 'audio/basic',
     
'avi' => 'video/x-msvideo',
   
'bcpio' => 'application/x-bcpio',
     
'bin' => 'application/octet-stream',
       
'c' => 'text/plain',
      
'cc' => 'text/plain',
    
'ccad' => 'application/clariscad',
     
'cdf' => 'application/x-netcdf',
   
'class' => 'application/octet-stream',
    
'cpio' => 'application/x-cpio',
     
'cpt' => 'application/mac-compactpro',
     
'csh' => 'application/x-csh',
     
'css' => 'text/css',
     
'dcr' => 'application/x-director',
     
'dir' => 'application/x-director',
     
'dms' => 'application/octet-stream',
     
'doc' => 'application/msword',
     
'drw' => 'application/drafting',
     
'dvi' => 'application/x-dvi',
     
'dwg' => 'application/acad',
     
'dxf' => 'application/dxf',
     
'dxr' => 'application/x-director',
     
'eps' => 'application/postscript',
     
'etx' => 'text/x-setext',
     
'exe' => 'application/octet-stream',
      
'ez' => 'application/andrew-inset',
       
'f' => 'text/plain',
     
'f90' => 'text/plain',
     
'fli' => 'video/x-fli',
     
'gif' => 'image/gif',
    
'gtar' => 'application/x-gtar',
      
'gz' => 'application/x-gzip',
       
'h' => 'text/plain',
     
'hdf' => 'application/x-hdf',
      
'hh' => 'text/plain',
     
'hqx' => 'application/mac-binhex40',
     
'htm' => 'text/html',
    
'html' => 'text/html',
     
'ice' => 'x-conference/x-cooltalk',
     
'ief' => 'image/ief',
    
'iges' => 'model/iges',
     
'igs' => 'model/iges',
     
'ips' => 'application/x-ipscript',
     
'ipx' => 'application/x-ipix',
     
'jpe' => 'image/jpeg',
    
'jpeg' => 'image/jpeg',
     
'jpg' => 'image/jpeg',
      
'js' => 'application/x-javascript',
     
'kar' => 'audio/midi',
   
'latex' => 'application/x-latex',
     
'lha' => 'application/octet-stream',
     
'lsp' => 'application/x-lisp',
     
'lzh' => 'application/octet-stream',
       
'm' => 'text/plain',
     
'man' => 'application/x-troff-man',
      
'me' => 'application/x-troff-me',
    
'mesh' => 'model/mesh',
     
'mid' => 'audio/midi',
    
'midi' => 'audio/midi',
     
'mif' => 'application/vnd.mif',
    
'mime' => 'www/mime',
     
'mov' => 'video/quicktime',
   
'movie' => 'video/x-sgi-movie',
     
'mp2' => 'audio/mpeg',
     
'mp3' => 'audio/mpeg',
     
'mpe' => 'video/mpeg',
    
'mpeg' => 'video/mpeg',
     
'mpg' => 'video/mpeg',
    
'mpga' => 'audio/mpeg',
      
'ms' => 'application/x-troff-ms',
     
'msh' => 'model/mesh',
      
'nc' => 'application/x-netcdf',
     
'oda' => 'application/oda',
     
'pbm' => 'image/x-portable-bitmap',
     
'pdb' => 'chemical/x-pdb',
     
'pdf' => 'application/pdf',
     
'pgm' => 'image/x-portable-graymap',
     
'pgn' => 'application/x-chess-pgn',
     
'png' => 'image/png',
     
'pnm' => 'image/x-portable-anymap',
     
'pot' => 'application/mspowerpoint',
     
'ppm' => 'image/x-portable-pixmap',
     
'pps' => 'application/mspowerpoint',
     
'ppt' => 'application/mspowerpoint',
     
'ppz' => 'application/mspowerpoint',
     
'pre' => 'application/x-freelance',
     
'prt' => 'application/pro_eng',
      
'ps' => 'application/postscript',
      
'qt' => 'video/quicktime',
      
'ra' => 'audio/x-realaudio',
     
'ram' => 'audio/x-pn-realaudio',
     
'ras' => 'image/cmu-raster',
     
'rgb' => 'image/x-rgb',
      
'rm' => 'audio/x-pn-realaudio',
    
'roff' => 'application/x-troff',
     
'rpm' => 'audio/x-pn-realaudio-plugin',
     
'rtf' => 'text/rtf',
     
'rtx' => 'text/richtext',
     
'scm' => 'application/x-lotusscreencam',
     
'set' => 'application/set',
     
'sgm' => 'text/sgml',
    
'sgml' => 'text/sgml',
      
'sh' => 'application/x-sh',
    
'shar' => 'application/x-shar',
    
'silo' => 'model/mesh',
     
'sit' => 'application/x-stuffit',
     
'skd' => 'application/x-koan',
     
'skm' => 'application/x-koan',
     
'skp' => 'application/x-koan',
     
'skt' => 'application/x-koan',
     
'smi' => 'application/smil',
    
'smil' => 'application/smil',
     
'snd' => 'audio/basic',
     
'sol' => 'application/solids',
     
'spl' => 'application/x-futuresplash',
     
'src' => 'application/x-wais-source',
    
'step' => 'application/STEP',
     
'stl' => 'application/SLA',
     
'stp' => 'application/STEP',
'sv4cpio' => 'application/x-sv4cpio',
  
'sv4crc' => 'application/x-sv4crc',
     
'swf' => 'application/x-shockwave-flash',
       
't' => 'application/x-troff',
     
'tar' => 'application/x-tar',
     
'tcl' => 'application/x-tcl',
     
'tex' => 'application/x-tex',
    
'texi' => 'application/x-texinfo',
  
'texinfo -  application/x-texinfo',
     
'tif' => 'image/tiff',
    
'tiff' => 'image/tiff',
      
'tr' => 'application/x-troff',
     
'tsi' => 'audio/TSP-audio',
     
'tsp' => 'application/dsptype',
     
'tsv' => 'text/tab-separated-values',
     
'txt' => 'text/plain',
     
'unv' => 'application/i-deas',
   
'ustar' => 'application/x-ustar',
     
'vcd' => 'application/x-cdlink',
     
'vda' => 'application/vda',
     
'viv' => 'video/vnd.vivo',
    
'vivo' => 'video/vnd.vivo',
    
'vrml' => 'model/vrml',
     
'wav' => 'audio/x-wav',
     
'wrl' => 'model/vrml',
     
'xbm' => 'image/x-xbitmap',
     
'xlc' => 'application/vnd.ms-excel',
     
'xll' => 'application/vnd.ms-excel',
     
'xlm' => 'application/vnd.ms-excel',
     
'xls' => 'application/vnd.ms-excel',
     
'xlw' => 'application/vnd.ms-excel',
     
'xml' => 'text/xml',
     
'xpm' => 'image/x-xpixmap',

     
'xwd' => 'image/x-xwindowdump',
     
'xyz' => 'chemical/x-pdb',
     
'zip' => 'application/zip',
    );

    
$ext get_file_extension($file);

    if (isset(
$types[$ext])) {
        return 
$types[$ext];
    }

    return 
'application/octet-stream';
}
// DROPDOWN MOD STARTS HERE  12/07/2008 ---------------------------
function get_dropdown_options($name$options = array(), $value ""$multi_dim 1$number 0$auto 0$keypress 0$extra ""$class ""$i_start 0$i_step 1$i_stop 1) {
  
$keypress = ($keypress) ? " onkeypress=\"if(window.event.keyCode==13)this.form.submit();\"" "";
  
$auto = ($auto) ? " onchange=\"this.form.submit();\"" "";
    
$dropdown "<SELECT name=\"".$name."\"".$auto.$keypress." class=\"".(($class) ? $class "select")."\"".$extra.">\n";
   
$i $i_start;
  if (
count($options)) {
    foreach (
$options as $key => $val) {
       
$what = (($number) ? $i : (($multi_dim) ? $key $val));
        
$dropdown .= "<option value=\"".$what."\"".(($value == $what) ? " selected" "").">".preg_replace (array("/{key}/siU""/{val}/siU""/{what}/siU""/{value}/siU"), array($key$val$what$value), $val)."</option>\n";
        
$i $i $i_step;
     }
  }else{
    for (
$i $i_start$i <= $i_stop$i += $i_step) {
        
$dropdown .= "<option value=\"".$i."\"".(($value == $i) ? " selected" "").">".$i."</option>\n";
    }
  }
   
$dropdown .= "</select>\n";
  return 
$dropdown;
}
function 
get_db_fields_dropdown($key$val$value) {
  return 
get_dropdown_options($key$val[3], $value$val[4], $val[5], $val[7], 1"""select"$val[6]);
}
// DROPDOWN MOD ENDS HERE  12/07/2008 -------------------------------
//-----------------------------------------------------
//--- Image Terms  MOD 12/07/2008----------------------
//-----------------------------------------------------
function terms_check($id$image = array())
{
  global 
$HTTP_COOKIE_VARS$site_sess$user_info$cat_cache;
  if (
$user_info['user_level'] == ADMIN || (!empty($image) && (($image['terms'] == && $user_info['user_level'] > GUEST) || ($image['terms'] == && $user_info['user_level'] > USER))) || (empty($image) && empty($cat_cache[$id]['terms']) || ($cat_cache[$id]['terms'] && (($cat_cache[$id]['terms'] == && $user_info['user_level'] > GUEST) || ($cat_cache[$id]['terms'] == && $user_info['user_level'] > USER)))))
  {
    return 
true;
  }
  
$name "terms";
  if (!empty(
$image))
  {
    
$id $image['image_id'];
    
$name .= "img";
  }
  if (
TERMS_COOKIES)
  {
    
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME "4images_";
    
$cookie_name .= $name.$user_info['user_id'];
    
$split_list = isset($HTTP_COOKIE_VARS[$cookie_name]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name])) : array();
    
$terms in_array($id$split_list);
  }
  if (!isset(
$site_sess->session_info[$name]))
  {
    
$site_sess->session_info[$name] = $site_sess->get_session_var($name);
  }
  
$split_list = array();
  if (!empty(
$site_sess->session_info[$name]))
  {
    
$split_list explode(" "$site_sess->session_info[$name]);
  }
  return ((
TERMS_COOKIES && $terms) || in_array($id$split_list));
}

function 
terms_add($id$image "")
{
  global 
$HTTP_COOKIE_VARS$site_sess$user_info$cat_cache;
  
$name "terms";
  if (
$image)
  {
    
$id $image;
    
$name .= "img";
  }
  if (
TERMS_COOKIES)
  {
    
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME "4images_";
    
$cookie_name .= $name.$user_info['user_id'];
    
$split_list = isset($HTTP_COOKIE_VARS[$cookie_name]) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name])) : array();
    if (!
in_array($id$split_list)) {
      
$cookie_termsid[] = $id;
      
setcookie($cookie_nameserialize($cookie_termsid), time() + TERMS_COOKIES_EXPIRECOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
    }
  }
  if (!isset(
$site_sess->session_info[$name]))
  {
    
$site_sess->session_info[$name] = $site_sess->get_session_var($name);
  }
  
$split_list = array();
  if (!empty(
$site_sess->session_info[$name]))
  {
    
$split_list explode(" "$site_sess->session_info[$name]);
  }
  if (!
in_array($id$split_list))
  {
    
$site_sess->session_info[$name] .= " ".$id;
    
$site_sess->session_info[$name] = trim($site_sess->session_info[$name]);
    
$site_sess->set_session_var($name$site_sess->session_info[$name]);
  }
}
//--- End Image Terms -------------------------------------
// MOD multi download
function multi_download_resize($file$new_file$quality$resize_width$resize_height) {
  global 
$convert_options;
  if (!
function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
  }
  
$convert_options init_convert_options();
  
$image_info = (defined("IN_CP")) ? getimagesize($file) : @getimagesize($file);
  if (!
$image_info) {
    return 
false;
  }
$scale min($resize_width/$image_info[0], $resize_height/$image_info[1]);
$new_width floor($scale*$image_info[0]);
$new_height floor($scale*$image_info[1]);
$resize_handle "resize_image_".$convert_options['convert_tool'];
if ($scale == '1'){
return $file;
}
elseif($resize_handle($file$new_file$quality$new_width$new_height$image_info)) {
@chmod($new_fileCHMOD_FILES);
return true;
}
else {
return false;
}
}
// END MOD multi download
?>




One more point .. Is it possible to disable to download higher size pictures when the size is small ? If the size is 1024x768 the automatically 1600x1200 and other big sizes will be disabled.. but user can download 800x600 size ..


Thanks,
batu
Title: Re: [MOD] Multi Download of same image
Post by: budduke on September 28, 2008, 06:53:52 PM
regarding batu544,

I just PM'd you a link to the modified functions file.
Let me know if this fixes the error or not.
It seems my MOD is calling routines that are not native to 1.7.4,
In case someone else is using 1.7.4 these are the functions that I added at the end of the functions.php file
Code: [Select]
// MOD multi download additional function for test
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;
}
// END MOD multi download additional function for test

Your other question about not letting bigger size downloads...
Will have to think about it. it seems doable. because the fomula for a bigger size will give a number above 1 on percent to resize and
I would think you could block it at the point, but would have to redo how it make the option list on the fly.
not sure about speed. Will look into that at some point when I get a chance.
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 12, 2008, 11:08:39 PM
WOW, I was looking this mod from around 6months & now, I got it, Thanks for making this mod.

Long Live 4image, Long Live budduke


Thanks again

EDIT: I am getting this error
Quote
Parse error: syntax error, unexpected ',' in C:\xampp\htdocs\4images\global.php on line 465

My 465 line is
Quote
  $result = $site_db->query($sql);,multi_download

When I remove ,multi_download this from line, My gallery become ok. I am also not seeing this one ( after removing ,multi_download from line 465)

(http://www.4homepages.de/forum/index.php?action=dlattach;topic=22741.0;attach=3832;image)


Please let me know, what should I do ?

Thanks in advance

Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 13, 2008, 12:14:08 AM
You placed it in the wrong place for that insert...
It does not get inserted after the sql line but actually inside it.
The line that starts with
Code: [Select]
$sql = "SELECTAt the end of that line place the
Code: [Select]
,multi_downloadIt get placed before the second line that starts with
Code: [Select]
FROM
My actual line reads like this, it may not look like yours because of different mods I am using...
Code: [Select]
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, cat_image, multi_download
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 13, 2008, 08:56:29 AM
My 465 line is this one. Yes, I have installed too many mods, Yes, I think line variation is due to this.

Quote
$result = $site_db->query($sql);

Please tell me how should I change this please, in the global.php file

Quote
if (defined("GET_CACHES")) {
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql,);

Where should I add ,multi_download. Please insert ,multi_download in above code, for sample

Thanks for your help
Title: Re: [MOD] Multi Download of same image
Post by: rinaldos on October 13, 2008, 09:04:04 AM
My 465 line is this one. Yes, I have installed too many mods, Yes, I think line variation is due to this.
Quote
$result = $site_db->query($sql);

Please tell me how should I change this please, in the global.php file

Quote
if (defined("GET_CACHES")) {
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql,);

Where should I add ,multi_download. Please insert ,multi_download in above code, for sample

Code: [Select]
if (defined("GET_CACHES")) {
  $sql = "SELECT cat_id, cat_name, cat_description, cat_parent_id, cat_hits, cat_order, auth_viewcat, auth_viewimage, auth_download, auth_upload, auth_directupload, auth_vote, auth_sendpostcard, auth_readcomment, auth_postcomment, multi_download
          FROM ".CATEGORIES_TABLE."
          ORDER BY cat_order, cat_name ASC";
  $result = $site_db->query($sql);

Here is the code :-)

Ingo

[EDIT by V@no]
removed extra comma in last line.
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 14, 2008, 11:00:44 PM
HI,

This is my files, can you please modify these for me

Code: [Select]
http://rapidshare.com/files/154050831/4images.zip.html
I will be very thankful to you :)
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 15, 2008, 02:04:29 AM
HI,

This is my files, can you please modify these for me

Code: [Select]
http://rapidshare.com/files/154050831/4images.zip.html
I will be very thankful to you :)

Just PM'd you the information you requested...
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 23, 2008, 08:35:42 AM
Hi, Thanks for this mod dear, I installed this on fresh 4images & Everything is fine now, but I am not seeing Multi Download button/Link on detail page, I believe this is my details.html (Template file) problem, here is my details.html, please guide me what should I change there.

Thanks Again
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 23, 2008, 12:10:19 PM
It looks like your details.html is setup correctly...

You are probably not activating the multisize download.
Go to your admin control panel and go to the catagory you are wanting to use this option and select edit.
You will see an option to turn this on for that catagory.
when you turn it on it will replace the normal download button and zip button with the new multi-size download button.
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 23, 2008, 12:45:59 PM
Thanks, Now another problem is here,

Quote
Fatal error: Call to undefined function check_big_type() in C:\xampp\htdocs\gallery\includes\functions.php on line 200

Is there any problem with my localhost, I am running this on my localhost ?

Here my functions.php

Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 23, 2008, 04:14:24 PM
What version of 4images are you using?
Look back on the other replies. I remember someone else having that error and they had 1.7.4
I am running 1.7.6 so I am not sure if that checkbigtype was added to the new version or not.
I am not sure why that error comes up but I think I posted a possible fix for it.
http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814 (http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814)
Title: Re: [MOD] Multi Download of same image
Post by: V@no on October 23, 2008, 04:31:46 PM
I am running 1.7.6 so I am not sure if that checkbigtype was added to the new version or not.
No, its not part of 4images. It's [Mod] Show original image in new window by clicking on image (http://www.4homepages.de/forum/index.php?topic=3236.0)
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 23, 2008, 09:54:17 PM
Hi,

I am very near to success,

Please check this

http://www.desktophut.com

Problem is, I uploaded high resolution images of over 1600x1200, when I try to download 1600x1200 image to 640x480, it become very blur, Even, if I download 1600x1200 image with same 1600x1200 resolution, result is same, Blur.

Please check at http://www.desktophut.com

Thanks

Kind Regards
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 23, 2008, 10:07:47 PM
in your admin control panel what is set under the
Conversion tool for thumbnails?
Mine is set for GD ...

not sure if that is where the problem is or not...

update...
look for this in the download.php file
Code: [Select]
$multi_var = multi_download_resize($multi_resize,$multi_new_image,90,$download_multi_sizes[$multi_download_select][1],$download_multi_sizes[$multi_download_select][2])
look for that ,90, in that line. I was using that for compression. I think in the GD library it gives you 90% of the quality.
maybe one of the others are thinking you are wanting to compress it by 90%.
Test it by changing it to ,10, for 10% compression and see what it does...
You will have to delete the resized files so it will re-create them again for you...

Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 24, 2008, 12:05:53 AM
Hi,

I am using 4images v1.7.6

Mine is GD too there,
Also, I have changed 90 to 10, but still result is same, blur images :(

admin/admin , login & password
Title: Re: [MOD] Multi Download of same image
Post by: mawenzi on October 24, 2008, 12:27:49 AM
... Mine is GD too there, ... , but still result is same, blur images ...

FAQ -> Bad thumbnail quality with GD2
http://www.4homepages.de/forum/index.php?topic=4543.0
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 24, 2008, 12:46:50 AM
Hi,

I am using 4images v1.7.6

Mine is GD too there,
Also, I have changed 90 to 10, but still result is same, blur images :(

admin/admin , login & password

if the fix from mawenzi does not fix your problem try this modified function file I have attached...
Let me know what it does so I can figure out how to better post this mod.
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 24, 2008, 07:59:25 AM
Wow, I did all & now, its working very fine. Please if you can test at your end, please test

Thanks all for great help.

Long Live 4images , Long Live budduke :D
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 24, 2008, 12:03:49 PM
Wow, I did all & now, its working very fine. Please if you can test at your end, please test

Thanks all for great help.

Long Live 4images , Long Live budduke :D

Can you try putting the CONVERT_IS_GD2 back to 0 and see if everything is still working or not so we have an idea if that fixed it or the modified file I sent you?
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 24, 2008, 12:49:49 PM
Hi,

Modified file to this, Convert_IS_GD2 didn't make any progess,

I have already changed Convert_IS_GD2 back to 0
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 24, 2008, 02:52:13 PM
My mod must be pulling from functions that are not native to 4images.
I have a version 2 of this mod ready to be published...
I will install it on a fresh install of 1.7.6 and make sure everything works before I publish it.

Glad it is working for you!
Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on October 25, 2008, 01:52:44 PM
Hello budduke,

Please tell me what did you modified in function file, now, I need to add this in my already modified gallery.

Regards
Title: Re: [MOD] Multi Download of same image
Post by: budduke on October 26, 2008, 12:23:22 AM
Hello budduke,

Please tell me what did you modified in function file, now, I need to add this in my already modified gallery.

Regards

not sure where some of the mods came from but some of them are from
http://www.4homepages.de/forum/index.php?topic=3236.0 (http://www.4homepages.de/forum/index.php?topic=3236.0)

Before I post version 2 of this mod I will try to not need all this extra stuff if I can avoid it.

but here goes...
NOTE TO ANYONE FOLLOWING THIS POSTING...
as you are searching the functions file, make sure you do not already have these changes already in your file

in includes/functions.php file

search for
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) : (($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;
// Download file block insert BEGIN
    switch( $image_type ) {
  case "media":
    if( $cat_id )
      $path = MEDIA_PATH."/".$cat_id;
else
  $path = MEDIA_TEMP_PATH;
    break;
      case "big":
        $path = MEDIA_PATH."/".$cat_id."/big";
    break;
      case "download":
        $path = MEDIA_PATH."/".$cat_id."/download";
    break;
  default:
    if( $cat_id )
      $path = THUMB_PATH."/".$cat_id;
else
  $path = THUMB_TEMP_PATH;
    break;
}
$path .= "/".$file_name;
// Download file block insert END
    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" && $image_type != "big") ? $return_code : ""); // Download file :: V@no big mod

search for
Code: [Select]
  $file_size = "n/a";
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
      $file_size = format_file_size($file_size);
    }
  }
  elseif ($detailed_view) {
    $file_size = get_remote_file_size($image_row['image_media_file']);
  }
 
replace with
Code: [Select]
  $file_size = "n/a";
  $download_file_size = "n/a";  // Download file
  if (!is_remote($image_row['image_media_file'])) {
    if ($file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'])) {
  $download_file_size = $file_size;  // Download file
      $file_size = format_file_size($file_size);
    }
// Download file Block BEGIN
if( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file']);
    elseif( file_exists(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']) )
  $download_file_size = @filesize(MEDIA_PATH."/".$image_row['cat_id']."/big/".$image_row['image_media_file']);
    $download_file_size = format_file_size($download_file_size);
// Download file Block END
  }
  elseif ($detailed_view) {
    $file_size = get_remote_file_size($image_row['image_media_file']);
  }

search for
Code: [Select]
    "url_download" => $site_sess->url(ROOT_PATH."download.php?".URL_IMAGE_ID."=".$image_row['image_id']),insert after
Code: [Select]
"download_image_file_size" => $download_file_size,  // Download file
"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),

search for
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) {
search for
Code: [Select]
    $media_src = get_file_path($media_file_name, "media", $cat_id, 0, 1);insert after
Code: [Select]
$media_src_big = get_file_path($media_file_name, "big", $cat_id, 0, 1);
search for
Code: [Select]
        $height = $image_info[1];insert after
Code: [Select]
$download_width_height = $width_height; // Download file
$download_width = $width; // Download file
$download_height = $height; // Download file

search for
Code: [Select]
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => format_text($image_name, 2),
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
insert before
Code: [Select]
// Download file info insert BEGIN
    $download_file_src = get_file_path($media_file_name, "big", $cat_id, 0, 1);
    $src_download = (!file_exists($download_file_src) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$download_file_src) : $download_file_src;
    if ($temp = @getimagesize($src_download)) {
      $download_width_height = " ".$temp[3];
      $download_width = $temp[0];
      $download_height = $temp[1];
    }
// Download file info insert END
insert after search code
Code: [Select]
      "download_width" => $download_width, // Download file
      "download_height" => $download_height, // Download file

search for
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);
search for
Code: [Select]
?>insert before
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;
}

// Download file block insert BEGIN
function check_remote_download($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_download($local_media_file) {
  global $config;
  return (preg_match("#^((\.)*\/.*?\.(".$config['allowed_mediatypes_match'].")$)#is", $local_media_file)) ? 1 : 0;
}
function check_download_type($file_name) {
  global $config;
  return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
// Download file block insert END

Hopefully this will clear up any problems anyone is having with my Mod!

Title: Re: [MOD] Multi Download of same image
Post by: lona_jasty on November 08, 2008, 02:53:26 PM
Quote
Parse error: syntax error, unexpected '}' in /home/deskhut/public_html/includes/template.php(101) : eval()'d code on line 81

Hi,
I tried to install this one my already modified 4images, everything is okay but, when I goto Details.php. I get this error. Everything was okay before installing this one, it happened after installing this mod.

Please help me

Regards
Title: Re: [MOD] Multi Download of same image
Post by: budduke on November 09, 2008, 03:06:17 PM
Quote
Parse error: syntax error, unexpected '}' in /home/deskhut/public_html/includes/template.php(101) : eval()'d code on line 81

Hi,
I tried to install this one my already modified 4images, everything is okay but, when I goto Details.php. I get this error. Everything was okay before installing this one, it happened after installing this mod.

Please help me

Regards

I have no clue what the template.php file is. my site does not have that file in it.
The error is stating that there is a } bracket without a { above it somewhere.
They always quote off different areas of code.
example:    a function {
                          some code;
                          some more code;
                         }    // the end of that function

hope that helps track down your error
Title: Re: [MOD] Multi Download of same image
Post by: KurtW on November 09, 2008, 03:31:31 PM
Hi lona_jasty,

look here:
http://www.4homepages.de/forum/index.php?topic=13143.msg70573#msg70573

Kurt
Title: Re: [MOD] Multi Download of same image
Post by: Computerman on January 05, 2009, 01:56:02 AM
Ok...I resolved my problem
Title: Re: [MOD] Multi Download of same image
Post by: lapas on January 22, 2009, 03:33:39 PM
I install all that was in first post but recieve errors
Fatal error: Call to undefined function check_big_type() in q:\home\localhost\www\****\includes\functions.php on line 242

after I install version 2

Fatal error: Call to undefined function: show_image() in q:\home\localhost\www\****\includes\page_header.php on line 244
in page_header

243  if (in_array($ext,$allow)) {
244  show_image($image_row);

What can I do?
Title: Re: [MOD] Multi Download of same image
Post by: V@no on January 22, 2009, 03:41:32 PM
Hello and welcome to 4images forum.

Looks like you made a mistake somewhere, probably in includes/functions.php
Restore backups and try again.
Title: Re: [MOD] Multi Download of same image
Post by: Fastian on March 14, 2009, 03:36:44 AM
Looks like the mod I am searching for :)
Anyone using this mod will like to share the site? (i.e. working demo)
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 06, 2009, 09:07:15 AM
Hi.

And why do I have when I want to maintain the selected size, showing a white page?
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 06, 2009, 03:10:32 PM
Hi.

And why do I have when I want to maintain the selected size, showing a white page?

Not sure what your question is?
When you select the size and select download are you getting a white page?
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 06, 2009, 08:36:58 PM
Hi.

And why do I have when I want to maintain the selected size, showing a white page?

When you select the size and select download are you getting a white page?

Yes - White Page
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 06, 2009, 10:30:31 PM
I would double-check the download.php file for anything that might have been inserted incorrectly...
If you can zip your changed files from the mod and attach them I will look them over for you...
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 07, 2009, 08:17:47 AM
I would double-check the download.php file for anything that might have been inserted incorrectly...
If you can zip your changed files from the mod and attach them I will look them over for you...


I checked, but just in case put a file in the archive.
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 07, 2009, 02:38:48 PM
I would double-check the download.php file for anything that might have been inserted incorrectly...
If you can zip your changed files from the mod and attach them I will look them over for you...


I checked, but just in case put a file in the archive.

I am curious, can you try this download.php file and see if any difference?

if still same problem, can you zip all the modified files? Your download file looked a little different then mine...
details.php
download.php
global.php
admin/categories.php
includes/constants.php
includes/functions.php
lang/english/admin.php
lang/english/main.php
template/your template you are using/details.html
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 07, 2009, 09:45:31 PM
Oops. Here are all the modified files
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 08, 2009, 12:07:35 AM
Oops. Here are all the modified files

The only one that did not look right was the details.php file. attached is that file...
If that still does not work. Can I see the problem in action? What is your website?
Title: Re: [MOD] Multi Download of same image
Post by: Tiburon on June 09, 2009, 11:31:16 AM
Did this Mod work for anyone with 4images 1.7.7 ?
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 09, 2009, 11:37:04 PM
Did this Mod work for anyone with 4images 1.7.7 ?
My site is runnign 1.7.7
I have not installed the mod on a plain unmodified 1.7.7 install yet. Will try that this weekend and let you know.

I am curious. When you select the size, and press download. Does it creat the modified file in the BIG subdirectory of your category?
Also, are the files local to the server or remote files?
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 14, 2009, 09:53:49 PM
Did this Mod work for anyone with 4images 1.7.7 ?
Just installed it on a fresh install of 1.7.7 and got a blank screen...
I then added the code in reply #9
http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814 (http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814)
That got it to start working...

sorry, I forgot about that addition...
Title: Re: [MOD] Multi Download of same image
Post by: Tiburon on June 15, 2009, 09:12:07 AM
Just installed it on a fresh install of 1.7.7 and got a blank screen...
I then added the code in reply #9
http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814 (http://www.4homepages.de/forum/index.php?topic=22741.msg124814#msg124814)
That got it to start working...

sorry, I forgot about that addition...

Wow, thank you for the quick answer. That sounds perfect. I will try it this week  :).
Is it also possible to open the selected images in a new browser window? Did you also try this with 1.7.7?
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 15, 2009, 09:18:22 PM
Found that the white screen is not always the case. The mod does not want to change the size, if the original resolution of 1600x1200
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 16, 2009, 12:49:17 AM
Found that the white screen is not always the case. The mod does not want to change the size, if the original resolution of 1600x1200
need more info to understand question...
Are you uploading a 1600X1200 size image and it does not resize to any of the other sizes, or certain ones?
It is by design that it will not stretch an image out of proportions in anyway.
so if your imagesize was 1600X1200, if you select 1920X1200 or 1600X1200 you will get the original size image because one of the dimensions is equal to the original by design.

Is that what is happening or is it something else?
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 19, 2009, 08:27:21 AM
Found that the white screen is not always the case. The mod does not want to change the size, if the original resolution of 1600x1200
need more info to understand question...
Are you uploading a 1600X1200 size image and it does not resize to any of the other sizes, or certain ones?
It is by design that it will not stretch an image out of proportions in anyway.
so if your imagesize was 1600X1200, if you select 1920X1200 or 1600X1200 you will get the original size image because one of the dimensions is equal to the original by design.

Is that what is happening or is it something else?

When you load an image 1600x1200, all permits, which are below, give a white page. If the image resolution is 1280x1024 or something else, then everything is fine.
Title: Re: [MOD] Multi Download of same image
Post by: budduke on June 20, 2009, 04:37:50 PM
Found that the white screen is not always the case. The mod does not want to change the size, if the original resolution of 1600x1200
need more info to understand question...
Are you uploading a 1600X1200 size image and it does not resize to any of the other sizes, or certain ones?
It is by design that it will not stretch an image out of proportions in anyway.
so if your imagesize was 1600X1200, if you select 1920X1200 or 1600X1200 you will get the original size image because one of the dimensions is equal to the original by design.

Is that what is happening or is it something else?

When you load an image 1600x1200, all permits, which are below, give a white page. If the image resolution is 1280x1024 or something else, then everything is fine.

Interesting, what type of server are you on? apache or windows based?
also, what are you using in your settings for "Conversion tool for thumbnails"?

I have only used this mod using GD library. Never could figure out how to install the others successfully.

Also, wondering if, when you upload this 1600X1200, what happens if you just ask it to create a thumbnail of that image?
I saw this in the archive and wondering if it might be what is happening...
http://www.4homepages.de/forum/index.php?topic=6664.0 (http://www.4homepages.de/forum/index.php?topic=6664.0)

I have installed this mod a few times on my server and uploaded 1600X1200 @300DPI and have not seen any troubles picking any of the sizes on my server...

[update]
Just posted version 2.0 of this mod. can you install it and see what it does for you?
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: Sebas Bonito on June 22, 2009, 09:09:30 PM
I already use the [Mod] Auto image resize on upload (http://www.4homepages.de/forum/index.php?topic=7700.0).

Are your Mod and the "autoimagareziser" compatible?
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 23, 2009, 01:48:40 AM
I already use the [Mod] Auto image resize on upload (http://www.4homepages.de/forum/index.php?topic=7700.0).

Are your Mod and the "autoimagareziser" compatible?

Looking over the code in that mod it should work. My mod deals with downloads and his deals with uploads...
Just to make sure I installed that mod along with my mod on my test server and everything is functioning correctly...

so the answer is a YES! :D
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: Sebas Bonito on June 23, 2009, 12:05:01 PM
I already use the [Mod] Auto image resize on upload (http://www.4homepages.de/forum/index.php?topic=7700.0).

Are your Mod and the "autoimagareziser" compatible?

Looking over the code in that mod it should work. My mod deals with downloads and his deals with uploads...
Just to make sure I installed that mod along with my mod on my test server and everything is functioning correctly...

so the answer is a YES! :D
It's cause there are no "big files" in the "mod auto image reziser". The maximum sizie is (e.g. in my project) 1024x***pixel. So during an upload the file will decrease, but the original file won't save in the "big"-folder, to use your MOD (and to offer higher resolutions).
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 23, 2009, 07:13:23 PM
I already use the [Mod] Auto image resize on upload (http://www.4homepages.de/forum/index.php?topic=7700.0).

Are your Mod and the "autoimagareziser" compatible?

Looking over the code in that mod it should work. My mod deals with downloads and his deals with uploads...
Just to make sure I installed that mod along with my mod on my test server and everything is functioning correctly...

so the answer is a YES! :D
It's cause there are no "big files" in the "mod auto image reziser". The maximum sizie is (e.g. in my project) 1024x***pixel. So during an upload the file will decrease, but the original file won't save in the "big"-folder, to use your MOD (and to offer higher resolutions).

It should still work, your uploaded files still go into the categories folder so if my mod does not see the file in the big folder then it uses the file in the normal category folder instead. What it does do is when it resizes the image, it does create a big folder in that category and places the resized file in the folder just so it is seperated from the normal files and to make it easier to delete (using the plugin with the mod) down the road...

hope this helps explain it for you...
Title: Re: [MOD] Multi Download of same image
Post by: DjeckMcNil on June 26, 2009, 10:07:18 PM
Found that the white screen is not always the case. The mod does not want to change the size, if the original resolution of 1600x1200
need more info to understand question...
Are you uploading a 1600X1200 size image and it does not resize to any of the other sizes, or certain ones?
It is by design that it will not stretch an image out of proportions in anyway.
so if your imagesize was 1600X1200, if you select 1920X1200 or 1600X1200 you will get the original size image because one of the dimensions is equal to the original by design.

Is that what is happening or is it something else?

When you load an image 1600x1200, all permits, which are below, give a white page. If the image resolution is 1280x1024 or something else, then everything is fine.

Interesting, what type of server are you on? apache or windows based?
also, what are you using in your settings for "Conversion tool for thumbnails"?

I have only used this mod using GD library. Never could figure out how to install the others successfully.

Also, wondering if, when you upload this 1600X1200, what happens if you just ask it to create a thumbnail of that image?
I saw this in the archive and wondering if it might be what is happening...
http://www.4homepages.de/forum/index.php?topic=6664.0 (http://www.4homepages.de/forum/index.php?topic=6664.0)

I have installed this mod a few times on my server and uploaded 1600X1200 @300DPI and have not seen any troubles picking any of the sizes on my server...

[update]
Just posted version 2.0 of this mod. can you install it and see what it does for you?

Version 2.1 is not working. And it is with a resolution of 1600x1200. All other permissions are working without conflict. Put the version of 4images 1.7.7 - does not work. And, too, with a resolution of 1600x1200!
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 27, 2009, 12:32:36 AM
@DjeckMcNil,
Can you give me a link so I can see it in action?

I have not heard of any complaint like that and have looked it over pretty good. 1600X1200 works for me...

Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: DjeckMcNil on June 27, 2009, 10:02:16 AM
@DjeckMcNil,
Can you give me a link so I can see it in action?

I have not heard of any complaint like that and have looked it over pretty good. 1600X1200 works for me...



Hello. Posted by site in the Personal Message. Thanks
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: lona_jasty on June 30, 2009, 05:07:42 AM
Hi

I am back & want my gallery update.

I have successfully installed it, but I don't know, what the problem is?

When I tried to select image resolution & then download, image downloaded, but its size is just around 259-261 bytes, yeah bytes.

Please can you tell me what I am doing wrong?

Here is my sample gallery
http://www.desktophut.com

Edit: I think, its the problem of "big" folder, I have created in "Media" & in Category say "3" folder too, but nothing change.

Regards
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 30, 2009, 12:11:42 PM
@lona_jasty,

The Mod should create the big folder on the fly if it is needed.
When you select the size and click download, does a big folder get created in that category folder?

can you PM me any temporary ftp access to look at the files?

Update: That users problem was fixed. one of the inserts in download.php was in the wrong location...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: GaYan on June 30, 2009, 03:44:07 PM
hey.. i need a modification ... all i need is to .. to show the buttons of images sizes instead of the drop down list...

or can i show them both ??

Please Help Me In this case // thanks in advance..

Regards . GaYan !
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 30, 2009, 03:48:33 PM
hey.. i need a modification ... all i need is to .. to show the buttons of images sizes instead of the drop down list...

or can i show them both ??

Please Help Me In this case // thanks in advance..

Regards . GaYan !
Version 2.1 should handle that for you...
look at the inserts that I made in the Global file at the end. You will see the variables in the MOD that you can change to fit your needs.
Quote
$multi_download_var['type'] = 0; //0=dropdown, 1=text links, 2=image links

Let me know if you need something further then that...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: varoon on June 30, 2009, 04:49:09 PM
Hi

Thx for the Grt MOD

i installed and its working fine on my latest build.

one problem here.. i am using very small size width and height.

Eg: 240 x 320

if i download a large image. it does not convert to the mentioned size. Either With or Height is in different size !!!

i just want it to scale to the mentioned size.

how do i do ?

and i dont see any option to Enable / disable is multi download in Admin panel.
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on June 30, 2009, 08:45:10 PM
Hi

Thx for the Grt MOD

i installed and its working fine on my latest build.

one problem here.. i am using very small size width and height.

Eg: 240 x 320

if i download a large image. it does not convert to the mentioned size. Either With or Height is in different size !!!

i just want it to scale to the mentioned size.

how do i do ?

and i dont see any option to Enable / disable is multi download in Admin panel.


I am assuming you are wanting your users to be able to select 240X320 as an option in the download list?

This can be handled in the Global.php file...
Quote
$download_multi_sizes= array(
   array('640X480',640,480),
   array('800X600',800,600),
   array('1024X768',1024,768),
   array('1280X960',1280,960),
   array('1400X1050',1400,1050),
   array('1600X1200',1600,1200),
   array('1280X800-wide',1280,800),
   array('1440X900-wide',1440,900),
   array('1680X1050-wide',1680,1050),
   array('1920X1200-wide',1920,1200)
   );

you can change it to look something like this?
Code: [Select]
$download_multi_sizes= array(
array('240X320',240,320),
array('640X480',640,480),
array('800X600',800,600),
array('1024X768',1024,768),
array('1280X960',1280,960),
array('1400X1050',1400,1050),
array('1600X1200',1600,1200),
array('1280X800-wide',1280,800),
array('1440X900-wide',1440,900),
array('1680X1050-wide',1680,1050),
array('1920X1200-wide',1920,1200)
);

you can also add other sizes or delete ones you know you do not use...

If I misunderstood your question please let me know...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: varoon on July 01, 2009, 09:59:25 AM
Quote
you can change it to look something like this?
Code: [Select]
$download_multi_sizes= array(
array('240X320',240,320),
array('640X480',640,480),
array('800X600',800,600),
array('1024X768',1024,768),
array('1280X960',1280,960),
array('1400X1050',1400,1050),
array('1600X1200',1600,1200),
array('1280X800-wide',1280,800),
array('1440X900-wide',1440,900),
array('1680X1050-wide',1680,1050),
array('1920X1200-wide',1920,1200)
);

you can also add other sizes or delete ones you know you do not use...

If I misunderstood your question please let me know...

Thx for the reply

Ya i found that code and Completely changed everything to new size.

But my question was, when i download an image of 240 x 320 form a large image, i got an uneven size like (203 x 320) OR (240 x 312) Depending on the original image size.

the conversion size was not 240 x 320.  :?

Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on July 01, 2009, 12:18:10 PM
Thx for the reply

Ya i found that code and Completely changed everything to new size.

But my question was, when i download an image of 240 x 320 form a large image, i got an uneven size like (203 x 320) OR (240 x 312) Depending on the original image size.

the conversion size was not 240 x 320.  :?



That question gets PM'd to me all the time so I thought I would answer it here for everyone...
The mod only resizes proportionally, it does not stretch or distort the image to get to the edges of the sizes that do not fit perfectly.
I never knew there was soo much interest in this addition. I am currently working on version 3.0 of this MOD. It will give a cropping feature that will resize the image larger then the size that is asked for and then crop off one of the sides to give you the exact size you are requesting but you will loose part of the image in the process. I may also put in a variable that will stretch the image to fit requested size, but I do not like that option personally because it makes people in the image look fat.

Stay tuned and glad it is working for you...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: varoon on July 01, 2009, 12:32:59 PM

That question gets PM'd to me all the time so I thought I would answer it here for everyone...
The mod only resizes proportionally, it does not stretch or distort the image to get to the edges of the sizes that do not fit perfectly.
I never knew there was soo much interest in this addition. I am currently working on version 3.0 of this MOD. It will give a cropping feature that will resize the image larger then the size that is asked for and then crop off one of the sides to give you the exact size you are requesting but you will loose part of the image in the process. I may also put in a variable that will stretch the image to fit requested size, but I do not like that option personally because it makes people in the image look fat.

Stay tuned and glad it is working for you...


Thx duke...

Streach and cutting Edges are good options... i would really like if both were there and user could choose it... :)

personally i too don't like those option.. but when user request  for a particular image size.. i cant convert all image and create a separate category.. hope u understand... this option is only for people who are lazy to convert images... :)

waiting for the update...  :wink:

thx in advance...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on July 02, 2009, 07:58:00 PM

Streach and cutting Edges are good options... i would really like if both were there and user could choose it... :)


User can choose it? Did not even think about that 8O
The version that I will be releasing will only be a global selection for the entire site. In order to allow the user to select, I will have to completely redo the code but may give it a try down the road.

The only issue I see is that allong with the original file you would then have a
resized_1024X768 file
resized_stretched_1024X768 file
resized_copped_1024X768 file
for each of the sizes that the user could choose, may get confusing on a large site but doable. at least the extra files would be in a big subfolder, easy to delete if running out of space.

If enough people think this would be a good addition I may work on it harder...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: lona_jasty on July 04, 2009, 01:14:44 AM
Hi budduke

when you are releasing v3 ?

Please fix this cropping issue in its v3.

Hope you will release v3 very shortly.

:D Regards
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on July 04, 2009, 06:21:40 PM
Hi budduke

when you are releasing v3 ?

Please fix this cropping issue in its v3.

Hope you will release v3 very shortly.

:D Regards

It is being tested on a friends site right now, he has found a few little programming bugs that I think are now fixed,
just waiting to here if everything is working without any issues before I post the changes...

[Updated]
Just updated my post with version 3.0
I looked into give the users the option to choose what they want.
I can possibly do this for the dropdown list because it is already a form
but the text_link and image_link options will not have this ability because they are not in the Form input
so I have decided not to go down that road of letting the users be able to select cropping feature unless enough people request it.
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: varoon on July 06, 2009, 08:15:32 AM

Streach and cutting Edges are good options... i would really like if both were there and user could choose it... :)


User can choose it? Did not even think about that 8O
The version that I will be releasing will only be a global selection for the entire site. In order to allow the user to select, I will have to completely redo the code but may give it a try down the road.

The only issue I see is that allong with the original file you would then have a
resized_1024X768 file
resized_stretched_1024X768 file
resized_copped_1024X768 file
for each of the sizes that the user could choose, may get confusing on a large site but doable. at least the extra files would be in a big subfolder, easy to delete if running out of space.

If enough people think this would be a good addition I may work on it harder...


just returned from small vacation...

Ya i understand when it comes on Large websites...

when a user chooses ( crop / Stretch ) a new file is created...

these are created on the Fly right ? so after few hours u can automatically delete them.. coz its not gonna use for other users... (let me know if im wrong)

Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on July 06, 2009, 12:09:49 PM
just returned from small vacation...

Ya i understand when it comes on Large websites...

when a user chooses ( crop / Stretch ) a new file is created...

these are created on the Fly right ? so after few hours u can automatically delete them.. coz its not gonna use for other users... (let me know if im wrong)



I talked myself out of the user being able to select options like that due to the way the mod is put together, so
since the settings are global, it will only create the size that user is asking for with the crop/stretch settings that you set for all the images, Yes, it does create a image_resized_1024X768.jpg file in the big folder. You can delete them if you want but if another user requests the same size download then they will automatically receive the one already created, saving server CPU time, so I would not delete them unless space is an issue.
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 08, 2009, 12:12:09 PM
Wow... Ver 3 is live !!!

updated the code and everything seems fine...

Thx... for the mod...

it would be even more good if user can select Crop / stretch

but there might be problem.. in current way of storing files.

coz.. when a user requested Crop and downloaded a file.. and if wants to select the same file and size.. the system does not generate again.. it gives the existing converted file...

so u have to generate download file each time for every user request...
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 10, 2009, 03:37:27 PM
hi.

How do i Auto Hide the Large resolutions download links than the Original image size

Eg:

original size  : 800 x 600
Large size : 1024 x 768

here i want to hide the 1024  in the download option..

is it possible ???
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: budduke on July 10, 2009, 08:48:00 PM
hi.

How do i Auto Hide the Large resolutions download links than the Original image size

Eg:

original size  : 800 x 600
Large size : 1024 x 768

here i want to hide the 1024  in the download option..

is it possible ???

I think this is what you are wanting?
http://www.4homepages.de/forum/index.php?topic=22741.msg137970#msg137970 (http://www.4homepages.de/forum/index.php?topic=22741.msg137970#msg137970)

you can just delete the arrays that you do not want people to be able to select.
This is a global settings so this will effect everyone and not just per user or per group.

If you are just wanting only sizes smaller the original then that setting will be in your admin panel, under categorie settings, you will see that as an option.

let me know if I mis understood your question
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: lona_jasty on July 11, 2009, 05:57:04 AM
Wow, Very happy to see v3.

Quote
* Added variables that you can now set crop settings to get actual size when resizing (New to ver 3.0)

Its great, if it will work perfectly.

Regards
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 13, 2009, 09:05:01 AM
hi.

How do i Auto Hide the Large resolutions download links than the Original image size

Eg:

original size  : 800 x 600
Large size : 1024 x 768

here i want to hide the 1024  in the download option..

is it possible ???

I think this is what you are wanting?
http://www.4homepages.de/forum/index.php?topic=22741.msg137970#msg137970 (http://www.4homepages.de/forum/index.php?topic=22741.msg137970#msg137970)

you can just delete the arrays that you do not want people to be able to select.
This is a global settings so this will effect everyone and not just per user or per group.

If you are just wanting only sizes smaller the original then that setting will be in your admin panel, under categorie settings, you will see that as an option.

let me know if I mis understood your question

Not Actually... later i found myself.. u hav already DONE it  :)

"""Only allow smaller sizes then original to be selectable""" ( available at Add / Edit categories at admin panel)

Thx for that option...  :mrgreen:

Can u provide an option to Delete all Files Created in BIG Folders ????  :roll:
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: budduke on July 13, 2009, 02:45:24 PM

Can u provide an option to Delete all Files Created in BIG Folders ????  :roll:

If you installed the mod correctly, there should be a plugin in your control panel that will clear out the resized files
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 13, 2009, 03:29:34 PM

Can u provide an option to Delete all Files Created in BIG Folders ????  :roll:

If you installed the mod correctly, there should be a plugin in your control panel that will clear out the resized files

Cool....  :thumbup:

"""Clear Multi Download Cache"""" just Found...  :wink:
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: GaYan on July 14, 2009, 10:44:38 AM
this mod rokzzzz..... The greatest mod in the gallery :) congratzzzzz
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 15, 2009, 12:22:17 PM
Hi i got a Error Message !

While i click New images i get error msg at top...  :(

url : /search.php?search_new_images=1

##########
Notice: Undefined variable: multi_download_options_string in /home/content/v/a/r/xxxx/html/xyz.com/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/content/v/a/r/xxxx/html/xyz.com/includes/functions.php on line 528
##########

i just found that its something related to Images per page

coz when i increase the no. of images displayed. Errors also occurs many times... 

may i know y this occurs ?? did anyone else get the same error ?


Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: budduke on July 16, 2009, 12:40:25 AM
Hi i got a Error Message !

While i click New images i get error msg at top...  :(

url : /search.php?search_new_images=1

##########
Notice: Undefined variable: multi_download_options_string in /home/content/v/a/r/xxxx/html/xyz.com/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/content/v/a/r/xxxx/html/xyz.com/includes/functions.php on line 528
##########

i just found that its something related to Images per page

coz when i increase the no. of images displayed. Errors also occurs many times... 

may i know y this occurs ?? did anyone else get the same error ?




The first error looks like you did not remove the old mod before pasting the new one in. Look at the blue area of my first post. I am no longer using that string in the mod. I will look over the original code to see if I forgot something...

The second error was an oversight on my part.
This is what I think will fix the problem. Let me know if it works and I will modify my original post to include the change.

in your functions file...
look for
Code: [Select]
$max_width = $site_template->val_cache['download_width'];
if (ISSET($max_width)){
$max_height = $site_template->val_cache['download_height'];
}
else {

Replace with...
Code: [Select]
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {

see what that does for you and let me know...
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 16, 2009, 09:03:39 AM
The first error looks like you did not remove the old mod before pasting the new one in. Look at the blue area of my first post. I am no longer using that string in the mod. I will look over the original code to see if I forgot something...

The second error was an oversight on my part.
This is what I think will fix the problem. Let me know if it works and I will modify my original post to include the change.

in your functions file...
look for
Code: [Select]
$max_width = $site_template->val_cache['download_width'];
if (ISSET($max_width)){
$max_height = $site_template->val_cache['download_height'];
}
else {

Replace with...
Code: [Select]
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {

see what that does for you and let me know...


i removed the code from my /includes/functions.php  

Code: [Select]
// MOD multi download

if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_options = $multi_download_options_string;
    $multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
                   </TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
                    <input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
//
$allow_download = 1;
    set_download_token($image_row['image_id']);

}
$site_template->register_vars("multi_download_options", $multi_download_options);
// END MOD multi download

and the first Error disappear!

(let me know if this code is need for some other purpose)


and for the second error, i replaced as u said

Code: [Select]
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {

and the second error also gone...  :D
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: Marcovich on July 20, 2009, 09:50:35 PM
If i have installed imagemagick, i need to change something? :)
Thanks :)
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: budduke on July 20, 2009, 11:24:32 PM
If i have installed imagemagick, i need to change something? :)
Thanks :)
Nothing inside the Mod needs changing, only the main settings of the 4images to redirect to the imagemagick folder.
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: varoon on July 21, 2009, 11:04:55 AM
what will happen if i have a zip or other than image files ?

will these Multi download option will be visible ? or just the default download option ?
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: budduke on July 22, 2009, 12:49:40 AM
what will happen if i have a zip or other than image files ?

will these Multi download option will be visible ? or just the default download option ?

interesting, that never crossed my mind. I always place zips and movies in different category but I guess I can understand why someone would want them in the same category...
Yes, that is a bug you found... :o

Will have to look into it and see if I can fix it or not...

UPDATED: This problem fixed with version 3.1
Title: Re: [MOD] Multi Size Download of same image [ver 3.0]
Post by: GaYan on July 23, 2009, 04:34:07 PM
hey,, i need some foolish modifcation :)

Admin can Upload Image in 3 ways - normal Quality , Midium Quality , High Quality

and the user must be able to download the 3 types above..and thier must be 3 different buttons to download them serperrtly..

pls..some 1 help me with this :) !
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: Sebas Bonito on July 23, 2009, 04:50:44 PM
It should still work, your uploaded files still go into the categories folder so if my mod does not see the file in the big folder then it uses the file in the normal category folder instead.

Okay the prob was caused of the safe_mode on settings. In "off" the original images will be saved also in the "big" folder.

NOW I'll take a look to this MOD  8)

The MOD works, but I get a server-error-log
Code: [Select]
[Fri Jul 24 00:29:03 2009] [error] [client x] PHP Notice: Use of undefined constant check_big_type - assumed 'check_big_type' in /srv/www/vhosts/rockbaer.de/httpdocs/daeof/includes/functions.php on line 2796, referer: http://www.4homepages.de/forum/index.php?topic=22741.90
On line 2796 my function it says
Code: [Select]
if (!function_exists(check_big_type)) { 
function check_big_type($file_name) {
global $config;
return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
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;
}
}

...so nothing special. Anybody knows where the problem is?
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: budduke on July 24, 2009, 01:02:12 AM
The MOD works, but I get a server-error-log
Code: [Select]
[Fri Jul 24 00:29:03 2009] [error] [client x] PHP Notice: Use of undefined constant check_big_type - assumed 'check_big_type' in /srv/www/vhosts/rockbaer.de/httpdocs/daeof/includes/functions.php on line 2796, referer: http://www.4homepages.de/forum/index.php?topic=22741.90
On line 2796 my function it says
Code: [Select]
if (!function_exists(check_big_type)) { 
function check_big_type($file_name) {
global $config;
return (in_array(get_file_extension($file_name), $config['allowed_mediatypes_array'])) ? 1 : 0;
}
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;
}
}

...so nothing special. Anybody knows where the problem is?

Another oversite on my part,

on line 2796 change it to read...
Code: [Select]
if (!function_exists('check_big_type')) {
I forgot the quotes  :oops:

I am about to post an update to the MOD in the next couple days, will add this to the list...
Title: Re: [MOD] Multi Size Download of same image [ver 2.1]
Post by: Sebas Bonito on July 24, 2009, 01:13:01 AM
Another oversite on my part,

on line 2796 change it to read...
Code: [Select]
if (!function_exists('check_big_type')) {
I forgot the quotes  :oops:

I am about to post an update to the MOD in the next couple days, will add this to the list...


Thx, that has fixed it  8)


I've found another server-error
Code: [Select]
[Fri Jul 24 22:57:42 2009] [error] [client x] PHP Notice: Undefined index: download_width in /srv/www/vhosts/de/httpdocs/daeof/includes/functions.php on line 726, referer: /member.php?action=showprofile&user_id=19
in my functions.php in line 726 it says
Code: [Select]
$max_width = $site_template->val_cache['download_width'];
if (ISSET($max_width)){
$max_height = $site_template->val_cache['download_height'];
}
else {
$max_width = $site_template->val_cache['width'];
$max_height = $site_template->val_cache['height'];
}


Update: Already fixed here (http://www.4homepages.de/forum/index.php?topic=22741.msg138676#msg138676). Thx budduke!
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on July 25, 2009, 05:00:32 PM
Both programming mistakes and showing normal download button if not an image are included with version 3.1 of this mod...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: varoon on July 28, 2009, 03:42:39 PM
what happen when i upload a Animated Gif ?

will that too get converted to smaller image and still animated ???
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on July 28, 2009, 06:00:04 PM
what happen when i upload a Animated Gif ?

will that too get converted to smaller image and still animated ???

When you upload an animated gif and tell 4images to create a thumnail for it. Is the thumbnail animated?
This mod does the same resizing that is used to create thumbnails...

So if the thumnails are animated then the resized gifs should be animated.
If not then for the animated gifs you will have to upload your own resized images to place in the big folder for those files.

UPDATED:
Doing more research into animated gifs, no this will not resize them correctly,
the best thing I can tell you to do would be to take gif out of the selection area of the mod so it will just get the normal download button instead...
But this would be for ALL gifs and not just animated ones.
in the details.php file look for this line in my insert...
Code: [Select]
if(!strpos(",jpg,jpeg,JPG,JPEG,png,gif",pathinfo($image_row['image_media_file'], PATHINFO_EXTENSION))){
Remove the ,gif from that line and you should be good...

Sorry, that is the best I can do...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: varoon on July 29, 2009, 09:30:41 AM
what happen when i upload a Animated Gif ?

will that too get converted to smaller image and still animated ???

When you upload an animated gif and tell 4images to create a thumnail for it. Is the thumbnail animated?
This mod does the same resizing that is used to create thumbnails...

So if the thumnails are animated then the resized gifs should be animated.
If not then for the animated gifs you will have to upload your own resized images to place in the big folder for those files.

UPDATED:
Doing more research into animated gifs, no this will not resize them correctly,
the best thing I can tell you to do would be to take gif out of the selection area of the mod so it will just get the normal download button instead...
But this would be for ALL gifs and not just animated ones.
in the details.php file look for this line in my insert...
Code: [Select]
if(!strpos(",jpg,jpeg,JPG,JPEG,png,gif",pathinfo($image_row['image_media_file'], PATHINFO_EXTENSION))){
Remove the ,gif from that line and you should be good...

Sorry, that is the best I can do...

Thx man... not a prob...

i will keep them in a separate folder and not going to enable multi download option...  :)

today came across some Cropping scripts

http://www.hotscripts.com/blog/javascript-image-cropping-scripts/

can these be implemented ???

i personally like the Kroppr but its Paid and the UvumiTools Crop its free!

Eg:
when i click on a download button.. say 800 x 600...
in the preview image show the selected cropping region... let width and height be fixed only u can select region and Download....
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on July 30, 2009, 12:19:45 AM
Thx man... not a prob...

i will keep them in a separate folder and not going to enable multi download option...  :)

today came across some Cropping scripts

http://www.hotscripts.com/blog/javascript-image-cropping-scripts/

can these be implemented ???

i personally like the Kroppr but its Paid and the UvumiTools Crop its free!

Eg:
when i click on a download button.. say 800 x 600...
in the preview image show the selected cropping region... let width and height be fixed only u can select region and Download....


That is funny because I looked at those scripts when I first started working on this mod...
The problem is that no 2 images would ever be the same. You could not save the files in any naming convention that would make them different from each other.
That is why I never went down that road. I would assume that you could save them in the temp folder each time the user asks for them. Not sure of load on server.

I may look into it down the road but too much going on for me to take the time right now...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: lapas on August 07, 2009, 06:46:44 PM
MOD is great, but in details.html image is very big size (some image size 1mb), the page slow downloading.
How make aditional thumb it was be great

http://www.4homepages.de/forum/index.php?topic=7700.0
this MOD and other impossible to establish for this mod, whether there are ways to solve this problem ?
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on August 07, 2009, 07:32:27 PM
MOD is great, but in details.html image is very big size (some image size 1mb), the page slow downloading.
How make aditional thumb it was be great

http://www.4homepages.de/forum/index.php?topic=7700.0
this MOD and other impossible to establish for this mod, whether there are ways to solve this problem ?

this thread should take care of your problem...
http://www.4homepages.de/forum/index.php?topic=20496.0 (http://www.4homepages.de/forum/index.php?topic=20496.0)
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: GaYan on August 11, 2009, 07:09:47 AM
Code: [Select]
Notice: Undefined variable: multi_download_options_string in /home/g2gayan/public_html/Gallery/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/g2gayan/public_html/Gallery/includes/functions.php on line 528

Notice: Undefined variable: multi_download_options_string in /home/g2gayan/public_html/Gallery/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/g2gayan/public_html/Gallery/includes/functions.php on line 528

Get the Following Error When using the Search Function :( Please Help meee :(

Here - I Have Attached My Functions.php Over Here

Code: [Select]
REMOVED
[EDIT by V@no]
if the code you are trying to show has more then 100 lines, attach it as a .txt or .zip file to your reply
[/EDIT]
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on August 11, 2009, 12:12:28 PM
Code: [Select]
Notice: Undefined variable: multi_download_options_string in /home/g2gayan/public_html/Gallery/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/g2gayan/public_html/Gallery/includes/functions.php on line 528

Notice: Undefined variable: multi_download_options_string in /home/g2gayan/public_html/Gallery/includes/functions.php on line 398

Notice: Undefined index: download_width in /home/g2gayan/public_html/Gallery/includes/functions.php on line 528

Get the Following Error When using the Search Function :( Please Help meee :(


please read the entire post to see if anyone else was having the same issues...
this issue was resolved with version 3.1 of this mod. Make sure you remove the old mod before adding the new and you should be good.
see this reply in this topic...
http://www.4homepages.de/forum/index.php?topic=22741.msg138676#msg138676 (http://www.4homepages.de/forum/index.php?topic=22741.msg138676#msg138676)
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: GaYan on August 11, 2009, 06:51:12 PM
Code: [Select]
// MOD multi download

if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_options = $multi_download_options_string;
    $multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
                   </TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
                    <input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
//
$allow_download = 1;
    set_download_token($image_row['image_id']);

}
$site_template->register_vars("multi_download_options", $multi_download_options);
// END MOD multi download

I Removed the above code from functions.php in order to remove my error "Notice: Undefined variable: multi_download_options_string in /home/g2gayan/public_html/Gallery/includes/functions.php on line 398"

Will It Do Any Harm To The Mode ?  :?:
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: mawenzi on August 18, 2009, 08:50:28 PM
Quote from: budduke
* You only need to upload one size of the file and the server will do the rest for you (I am lazy)
  all the other mods I saw wanted you to create all the different sizes before you uploaded them.
  This mod will create the resized images at the time the user is asking for them.

... not quite right ... ;)
... [TUT] One Image - Three Sizes ... created all the images versions ( 3 pieces ) during the upload process ...
... btw. ... superb MOD ... your Multi Size Download of same image ...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: edonai on August 23, 2009, 03:21:38 AM
Hello budduke,

Can you help me? Your mod work like a charm when i select dropdown in global.php
But if i want to select text link or image link, the resize no longer works and when I click on the link, I download the orignal image.

Thanks for your help

Edonai
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: dizizi on August 23, 2009, 06:30:35 AM
Mod is working well :D! but can you tell me how much memory this mod will use when resize image? I use free host so i want to know that  :(
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on August 23, 2009, 04:23:06 PM
@edoni,
It should work, You may look over all the inserts to make sure you put them in the correct area.

Can you give link to your site so I can see what is happening?

@dizizi,
I would think it uses the same amount of memory as it would if it was creating thumbnails or any other resizing command that you do on the site.
One nice thing is that it only does it once for each size, after that, if it sees the file already created then it does not re-create it.
I know that did not exactly answer your question but I do not know how to monitor mem usage as a script runs,  :( sorry
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: dizizi on August 24, 2009, 08:15:07 AM
If i use too much memory, my admin will close my site! I think i must contact them about this script  :(
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on August 25, 2009, 12:17:53 AM
If i use too much memory, my admin will close my site! I think i must contact them about this script  :(

I am assuming that when you say memory you mean cpu server processing load...
If you feel that it may be a problem, you could go ahead and create your different size files for each size on your local computer and name them correctly so they fall into that filename_resized_whateversize.jpg, allot of work for you to do locally, and then just upload all those resized images to the big folder of those categories and then the server will not have to process anything. It would just have to pick the correct image for the user to download.
That is the best workaround I can think to give you, if you are up to the task...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: edonai on August 25, 2009, 09:08:06 PM
Hello budduke,

Can you help me? Your mod work like a charm when i select dropdown in global.php
But if i want to select text link or image link, the resize no longer works and when I click on the link, I download the orignal image.

Thanks for your help

Edonai

problem solved by budduke, a big thanks to him
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on September 17, 2009, 12:16:13 AM
IN NEED OF HELP!
A user is having problems with my mod and I have looked over the code and do not see anything that I may have overlooked to cause the problem and was hoping that someone that understands the hotlinking token could chime in...

They are claiming that 50% of the time when their users are selecting one of the different sizes of an image they are recieving the "hotlinking not allowed" message. My understanding is that if they just select the original over and over it is fine but it happens when they select a different size in the list.

I looked over where my mod is doing the set_download_token and I thought I put everything in the correct spot.
I can not duplicate this problem on my test server and am not sure how to troubleshoot it from here...

Thanks for any help anyone can give,
Buddy Duke
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: V@no on September 17, 2009, 03:44:59 AM
Can I see that user's gallery? With exact step-by-step how to reproduce
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on September 17, 2009, 09:12:17 PM
Thanks V@no,
It is not on my server but someone elses...
Here is the link that is giving him all the trouble. It is doing everytime I click on any of the different sizes, even original. So something is messed up
http://backgroundscity.co.cc/hilary_duff_332/hilary-duff-%2828%29-30602.htm (http://backgroundscity.co.cc/hilary_duff_332/hilary-duff-%2828%29-30602.htm)
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: V@no on September 18, 2009, 04:25:45 AM
The download links are pointed to a different domain - that is the problem. Cookies can not be shared between domains, that creates new session when clicked on download link.
If you open the same page, but with "correct" domain (http://www.backgroundscity.net/hilary_duff_332/hilary-duff-(28)-30602.htm) then downloads working fine.
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on September 18, 2009, 12:11:23 PM
Thanks again V@no,
I kept looking over that link and I knew it did not look right but it just didn't sink in till I read your reply
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: varoon on November 20, 2009, 01:27:39 PM
The current Thumb creation does center crop only or left or right or resize to fit...

but im looking for resize and then crop to fit....

can u add a new option (5) resize and crop to fit..

i found some code which does exact wat i need..

PHP+GD Output

http://911-need-code-help.blogspot.com/2009/04/crop-to-fit-image-using-aspphp.html

can this be implemented ?  :?:

or im wrong somewhere ??  :?
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: goblue7 on November 22, 2009, 12:33:08 AM
First of all thank you for writing an excellent mod.  The basis of my entire website depends on this mod and I appreciate you taking the time to write it.

Hopefully someone will be able to help me.

I implemented the entire modification as per instructions.  I received an error and did it all over again from the beginning to make sure it was not an error in the way I placed the code and order of installs, etc...

In short, it is not working for me...

Getting the error :

Warning: Invalid argument supplied for foreach() in /home...............admin/categories.php on line 67

I have checked this over many times and am certain I have the code changes for that page correct.  Anyone have any ideas?

I thank you very much for your time in reading this and appreciate any help you may have to offer.
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on November 22, 2009, 10:40:32 PM
@Varoon,
Not sure what you are asking...
this is in the code...
Code: [Select]
/* what crop will do is resize image larger then size that is asked for unless it detects it will resize without and extra space.
then it will crop off the extra area to give you the actual size asked for (loosing part of your image)
0= do not crop
1= crop equally on both sides
2= crop top or left side
3= crop bottom or right side
4= resize and stretch to fit requested size (no crop)
*/
What is currently does is reduce the image to whichever comes first (width/height) without adding any extra space before it does the crop. That is the only way I can think of it actually working correctly. Is this what you were thinking or can you give me more details on what you would like?

@goblue7,
Not sure why it is not working for you, Can you post a zip file containing all the files you changed so I can look them over?
Mainly these file should be in the zip file and also if you have added other mods before this one, if you could list them for me so I have an idea of how they are all interacting?
details.php
download.php
global.php
admin/categories.php
includes/constants.php
includes/functions.php
lang/english/admin.php
lang/english/main.php

I have allot going on with the holidays but will try to look it over for you...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: goblue7 on November 23, 2009, 03:36:53 PM
Thank you for taking the time to reply and offer to look at the files.  It is very appreciated.

I don't have any other mod installed in the gallery.  This was a fresh install ( I have only used 4images twice in the past mod free) but this one is for my own site.  I have never used 4images for myself because I was unaware of this mod and many others.   It is my very first mod install, but I am very certain I have followed the instructions accurately.  So we are dealing with a fresh install, and an attempt to install this mod only.  :)

I forgot to mention that I modified the php files using Adobe Dreamweaver CS3.  This may have been the wrong thing to use for php file modification.


Thank you again.

Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on November 24, 2009, 01:04:39 AM
Thank you for taking the time to reply and offer to look at the files.  It is very appreciated.

I don't have any other mod installed in the gallery.  This was a fresh install ( I have only used 4images twice in the past mod free) but this one is for my own site.  I have never used 4images for myself because I was unaware of this mod and many others.   It is my very first mod install, but I am very certain I have followed the instructions accurately.  So we are dealing with a fresh install, and an attempt to install this mod only.  :)

I forgot to mention that I modified the php files using Adobe Dreamweaver CS3.  This may have been the wrong thing to use for php file modification.


Thank you again.


:wink:
Check the instructions again under the lang\english\admin.php file.
You never inserted the insert in that file...

Don't feel bad, I have made crazier mistakes then that myself.
The only dumb question is the one never asked!

That should fix it for you...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: goblue7 on November 24, 2009, 03:45:32 AM
Thank you for taking the time to reply and offer to look at the files.  It is very appreciated.

I don't have any other mod installed in the gallery.  This was a fresh install ( I have only used 4images twice in the past mod free) but this one is for my own site.  I have never used 4images for myself because I was unaware of this mod and many others.   It is my very first mod install, but I am very certain I have followed the instructions accurately.  So we are dealing with a fresh install, and an attempt to install this mod only.  :)

I forgot to mention that I modified the php files using Adobe Dreamweaver CS3.  This may have been the wrong thing to use for php file modification.


Thank you again.


:wink:
Check the instructions again under the lang\english\admin.php file.
You never inserted the insert in that file...

Don't feel bad, I have made crazier mistakes then that myself.
The only dumb question is the one never asked!

That should fix it for you...



Oh man, I tell you...Sorry about that :(   You knew I was going to feel like a fool for that one....

Thank you very much... it did fix it for me.  I appreciate you taking the time to look over the files and find the mistake.  Kicking myself...I missed it twice :)
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: goblue7 on November 26, 2009, 06:38:07 PM
I've noticed a few issues and wanted to ask here before attempting anything else.

My apologies if already answered, I have spent hours in here trying to find out answers to a few questions and have been unable to do so, or I am looking in the wrong spot.  So therefore I will now post :)

I'll tell you what I am trying to do, and maybe someone can offer some direction...thank you!

What I want to do is have a registered user able to click on the thumbnail, and have an image that only open 800 wide (don't care about height, just want it proportioned properly at 800 wide) and then, have the ability to click on the download link below the image (this excellent mod) and decide the size of the image they want to download, be it one of the sizes given (which are perfect for me) or the full entire huge image.

My problem is this....I deal with thousands of photos, and they default at 5184x3456 (15-25mb each) sometimes they are off depending on touch ups...removal of unwanted items and so on...sometimes 4800x2600, other odd numbers maybe 3560x2246...you get the idea.  After the amount of work, and number of photos (I'll take as many as 700 for one football game) it is too difficult to resize them all to make it perfect for this web site and have to touch them all up just the same.  Touching up the photos is too time consuming as it is, not to mention the quantity I have to do, yet alone now have to reszie them all proportionally to work with this mod successfully.  I was hoping the mod could do it automatically.  :)

I currently only use this mod, and I suspect I may have to add another to pull this off.  However, using this mod when a user tries to download an image via the drop down menu, no matter what size they choose (and it is always smaller than original) it never re-sizes correctly, comes up small and is lossy so to speak at 300kb or so etc...when I know the original is huge.  I don't mind auto cropping or any of that...parts of the image unviewable and do understand this...I just can't get it to do it regardless.  They are always the same no matter which choice in the download menu I select.  On a few occasions, with some of the photos I have tried to upload now to test this mod, the drop down menu won't even show up in all cases....most but not all.  I suspect this may have to do with the size of the image, or how I am viewing it.

So basically to sum it up, I want it similar to what you see at the web sites such as flickr, or the gallery photo mod (similar to 4images which I don't want to use)  see thumbnails, click on a thumbnail, get a bigger view of 800, then decide what to do , as a user, and download the size you want.
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on November 26, 2009, 11:05:48 PM
To answer most of your question...
http://www.4homepages.de/forum/index.php?topic=20496.0 (http://www.4homepages.de/forum/index.php?topic=20496.0)

the one about quality, not sure. Can you PM me your website to look at to see what is happening?
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: sippiseincousin on January 18, 2010, 02:59:05 PM
Hey,

that looks like a very nice script, but i have a question.

What is about the DPI from the Picture? Can i modify it?

And can i replace the resolution in my own sizes?
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Rembrandt on January 18, 2010, 05:13:16 PM
...
What is about the DPI from the Picture? Can i modify it?...
DPI = Dots per Inch (http://en.wikipedia.org/wiki/Dots_per_inch), This has nothing to do with the image.
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on January 19, 2010, 12:34:15 AM
Hey,

that looks like a very nice script, but i have a question.

What is about the DPI from the Picture? Can i modify it?

And can i replace the resolution in my own sizes?
Your question about DPI, no. it is set at 96dpi (I think).
The best answer would be, if your user is wanting the higher DPI resized, they should download the original image and resize it on their own computer. besides, dealing with big files and resizing them all the time with large DPI settings would put allot of load on a web server.
You can read more about our DPI debate at...
http://www.4homepages.de/forum/index.php?topic=26422.0 (http://www.4homepages.de/forum/index.php?topic=26422.0)
From the debate, I think we came up with the conclusion that if you have imagemagic loaded on your server, there is a command inside that graphic library that allows you to play with DPI but I have not researched it beyond this Mod.

Your second question about replacing resolution with your own sizes...
look at the second insertion in the global.php file of the Mod. That is where you list the sizes you want the user to see.

Hopefully those are the answers you are searching for,
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: sippiseincousin on January 19, 2010, 09:53:14 AM
Hey,

thanks for your answer!

It was exactly the answer i was looking for!
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on February 22, 2010, 07:04:37 PM
Itīs a really good mod that works fine for me with 1.7.7. Thank you for this fine piece of work, budduke  :)

There is only one thing that I would like to change. Is it possible, that the image opens in a new browser window if the user clicks on link/button/dropdown, so that he can set it immediately as wallpaper?

I tried to modyfiy sth. like target='blank' in functions.php, but either that doesn't work or I did it in the wrong way.

Has anybody an idea how to realize this ?

Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on February 23, 2010, 01:08:46 AM
There is only one thing that I would like to change. Is it possible, that the image opens in a new browser window if the user clicks on link/button/dropdown, so that he can set it immediately as wallpaper?

I tried to modyfiy sth. like target='blank' in functions.php, but either that doesn't work or I did it in the wrong way.

I do not think this is possible because the buttons are using the download command so it is trying to save the file to your hard drive and not just viewing the image.
Are images the only items that are on your site? There may be a way of modifying the send_file function in the download.php file to open a new window with the image but that would be a modification that would be like that for everything on your site.

If I find time I will see what I can do...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on February 23, 2010, 07:57:48 AM
I do not think this is possible because the buttons are using the download command so it is trying to save the file to your hard drive and not just viewing the image.
Are images the only items that are on your site? There may be a way of modifying the send_file function in the download.php file to open a new window with the image but that would be a modification that would be like that for everything on your site.

If I find time I will see what I can do...


thank you for your immediate reply. Yes, on my website are only images (wallpaper site). Your mod is a perfect addition to 4images for anyone who wants to offer images in many different sizes and who wants to use all the other advantages of 4images instead of using one of this inflexible and static mass-scripts which you can see now all around the web. So it would be really fantastic if there would be a way to modify that download.php file  :)
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on March 12, 2010, 01:59:38 PM
I have another question concerning your Mod.

Would it be possible to style this part a little bit ?

Quote
$download_multi_sizes= array(
   array('640X480',640,480),
   array('800X600',800,600),
   array('1024X768',1024,768),
   array('1280X960',1280,960),
   array('1400X1050',1400,1050),
   array('1600X1200',1600,1200),
   array('1280X800-wide',1280,800),
   array('1440X900-wide',1440,900),
   array('1680X1050-wide',1680,1050),
   array('1920X1200-wide',1920,1200)
   );

I would like to section it a little bit so that it looks sth like this:

$download_multi_sizes= array(
   
   Fullscreen:
   array('640X480',640,480),
   array('800X600',800,600),
   array('1024X768',1024,768),
   array('1280X960',1280,960),
   array('1400X1050',1400,1050),
   array('1600X1200',1600,1200),
   
   Widescreen:
   array('1280X800-wide',1280,800),
   array('1440X900-wide',1440,900),
   array('1680X1050-wide',1680,1050),
   array('1920X1200-wide',1920,1200)
   );
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on March 13, 2010, 02:24:08 AM
@ Tiburon,
when you say style I am assuming laying them out on the page in a certain manner, how are you wanting the buttons/links to look when laid out on the screen?
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on March 13, 2010, 06:39:44 PM
@ Tiburon,
when you say style I am assuming laying them out on the page in a certain manner, how are you wanting the buttons/links to look when laid out on the screen?


Hi budduke,

I thougt about seperating the links in the Dropdown a little bit like this:

Widescreen 16:9
 2560x1440
 1920x1080
Widescreen 16:10
 2560x1600
 1920x1200

...and so on. This would make it easier for the visitors to find the wallpaper-resolution that the want.




Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Rembrandt on March 13, 2010, 06:54:10 PM
Hi!

@budduke, he need this:

     <optgroup label="Widescreen 16:9">
       <option value="2560x1440">2560x1440</option>
       <option value="1920x1080">1920x1080</option>
      </optgroup>
     <optgroup label="Widescreen 16:10">
       <option value="2560x1600">2560x1600</option>
       <option value="1920x1200">1920x1200</option>
     </optgroup>

mfg Andi
     
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on March 17, 2010, 12:26:29 AM
@ Tiburon,
I think it I can do it but it would take some redoing of some of the coding to make it work...
Let me think about it, I am also looking into the opening instead of download request on this Mod also...

@ Rembrandt,
Thanks for clarifying it for me...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on March 28, 2010, 12:41:47 PM
@ Tiburon,
I think it I can do it but it would take some redoing of some of the coding to make it work...
Let me think about it, I am also looking into the opening instead of download request on this Mod also...

Thanks for doing such a fantastic support. :)

I have another little problem that I canīt solve.
Iīm using your mod together with this one: http://www.4homepages.de/forum/index.php?topic=7700.msg22313#msg22313

What happens now is that everything works fantastic when I choose the option "Yes, Allow all sizes to be selectable". The mod chooses obviously the copied original image in the big-folder to resize the images and does the work.

The problem appears if I choose "Yes, Only allow smaller sizes then original to be selectable". In that case I get no Download-Options in the Dropdown menu. As far as I can see, it seems that the mod in that case doesnīt check the "big" folder with the copied original image, but the basic folder of the category and there is only the small, resized image that is shown on detail.php so that no options in the dropdown are shown. (This image has smaller dimensions than the smallest resolution that I want to offer as download)

Do you have any idea what I have to change, or where my fault is ??



Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: budduke on March 28, 2010, 06:40:33 PM
@ Tiburon,
I would say something got placed in the files incorrectly because I am using the same mod without those types of issues.
If you could zip all your files that got changed with these 2 mods and give me a link to download the zip file, I will try to look it over to see if I see anything...
Title: Re: [MOD] Multi Size Download of same image [ver 3.1]
Post by: Tiburon on March 28, 2010, 08:19:02 PM
@ Tiburon,
I would say something got placed in the files incorrectly because I am using the same mod without those types of issues.
If you could zip all your files that got changed with these 2 mods and give me a link to download the zip file, I will try to look it over to see if I see anything...

Well, thanks for the offer.  :)

First I will try it again with a clean installation to check it because I donīt want to waste your time, but when the result is the same I would be very glad if you would be so kind to look over it. Thank you !
Title: Re: [MOD] Multi Size Download of same image [ver 4.0]
Post by: budduke on April 11, 2010, 12:44:18 AM
@Tiburon,

I just replaced my original post with version 4 of this mod that includes
the grouping option that you ware requesting
and the popup window instead of download (not set by default, look at the insert variable for TARGET in the Global insert)

let me know how it works for you...
Title: Re: [MOD] Multi Size Download of same image [ver 4.0]
Post by: Tiburon on April 19, 2010, 10:29:03 AM
Hi budduke,

first of all, thank you for spending the time to do such excellent improvements.

I tried the mod with a brandnew installation of 4images 1.7.7 First I had problems with the download.php but when I chose the one you provided earlier in this thread and modified it this problems were solved.

I installed the mod and these two Mods :

http://www.4homepages.de/forum/index.php?topic=6759.0 (http://www.4homepages.de/forum/index.php?topic=6759.0)
http://www.4homepages.de/forum/index.php?topic=4754.0 (http://www.4homepages.de/forum/index.php?topic=4754.0)

Finally there is only one problem left that I couldnīt solve until now:

I uploaded an image, checked it with new checkimages.php and chose the option to copy original file to "big" folder. I selected "Yes, Only allow smaller sizes then original to be selectable" in ACP and then happens that mod doesnīt choose the image in "big" folder with the copied original image to create new download options, but the basic folder of the category and there is only the small, resized image in basic folder. As the size of resized image is 640x360 I get all the smaller options (Blackberry and Mobile) in my dropdown.

Update: I found out that the mod "knows", that the original file is in the "big" folder, because wenn I choose the "original file, it is the big one from "big" folder. I assume that I have to install another mod to make this thing work (but I donīt know which) Another possibility would be that the script "calls" the wrong imagepath at the point of resizing the image. Do you have any idea ??

To be sure that I didnīt make mistakes when I installed the mod, I did it now 4 times (twice on my local server, twice on my server) but the result is the same.


Title: Re: [MOD] Multi Size Download of same image [ver 4.0]
Post by: budduke on April 19, 2010, 11:37:15 PM
@ Tiburon,
The easiest way would be to zip your changed files and post them or send me a link to download them from and I will take a look at them.
I use a program that compares file very easy and points out the differences pretty quickly so it will not take much of my time to look it over...

PS: I am also using the other mods you listed without any problems
Title: Re: [MOD] Multi Size Download of same image [ver 4.0]
Post by: Tiburon on April 20, 2010, 09:26:07 AM
Hi budduke,

I sent you a link with the files via PM. Thanks a lot for checking my files.  :)
Title: Re: [MOD] Multi Size Download of same image [ver 4.0]
Post by: budduke on April 21, 2010, 02:59:55 PM
@Tiburon and eveyone else,
version 4 has an issue, wait for update before using

UPDATED: fixed a programming bug in the one insert for the functions file, it reads (updated for ver 4.1)

also, if you are using the big mod, make sure you have everything that is posted at this link in your functions file also...
http://www.4homepages.de/forum/index.php?topic=22741.msg126345#msg126345 (http://www.4homepages.de/forum/index.php?topic=22741.msg126345#msg126345)

Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: rinaldos on May 05, 2010, 06:25:32 PM
This MOD works great. Maybe another feature for the next version:
Original Images only for registered Users

Gruß
Ingo
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: satine88 on May 16, 2010, 12:27:51 PM
Hello :)

I've a error :
Code: [Select]
An unexpected error occured. Please try again later.

Warning: Cannot modify header information - headers already sent by (output started at /homez.93/fondecra/www/includes/db_mysql.php:192) in /homez.93/fondecra/www/includes/sessions.php on line 168

Warning: Cannot modify header information - headers already sent by (output started at /homez.93/fondecra/www/includes/db_mysql.php:192) in /homez.93/fondecra/www/includes/sessions.php on line 169
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: budduke on May 16, 2010, 03:45:35 PM
@satine88,
Did you run the installer file to place the entries in your database?

It looks like you have placed some information in the wrong places...

If you have tried a few times and still can not get anywhere, zip the changed files and provide me a link to download them and I will take a look...
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: satine88 on May 16, 2010, 06:14:29 PM
@satine88,
Did you run the installer file to place the entries in your database?

It looks like you have placed some information in the wrong places...

If you have tried a few times and still can not get anywhere, zip the changed files and provide me a link to download them and I will take a look...

I reinstalled the mod, I have no error, but I have no module in the page detail.html

I tested by turning on the category (via admin / categorie.php)
http://www.fond-ecran-gratuit.biz/cat-korn-344.htm

the changed files :
http://rapidshare.com/files/388030694/budduke.rar.html
Thank you, sorry for my English (if I do a lot of fault)
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: budduke on May 16, 2010, 07:40:36 PM
@satine88,
Just sent you a link of the repaired functions file...
Let me know if it fixes it or not.
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: satine88 on May 17, 2010, 07:49:02 PM
Thanks you budduke :) !
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: batu544 on June 02, 2010, 09:14:17 PM
Hi budduke,
                              After a long time I tried to put this MOD in my gallery and made all the changes in my test gallery. After doing the changes, I tried to resize one wide screen (1280x800) image and one normal (1600x1200) image to a lower size image and the output size came up like below..

1280x800 resized :
Resize option selected actual resized image
1024x7681024x640
800x600800x500
1280x7201152x720

1600x1200 size image ;
Resize option selected actual resized image
800x600800x600
1024x7681024x768
1280x8001066x800
1400x10501400x1050

After seeing this, I thought, it would be great if we only resize the a widescreen image to other small wide-screen format image and normal (4:3) resolution image to other smaller size images.

So, now the questions are ..

1. Is it possible to make the changes in the code, to display only different widescreen resolutions on the screen, if the image is actually a widescreen image and  display only normal resolution options, if the image is a normal resolution image ?

2. Right now if we are selecting to open the resize image in a new window then the address bar looks like

www.yourdomain.com/download.php?action=resize&image_id=4609&multi_download_select=8  

Is it possible to make some changes ( may be in .htaccess or some other file ) so that the url will be like ..

www.yourdomain.com/r-image-name-image_id-1280x800.htm   ?

1280x800 will be different for different size images...



Any help on this is appreciated... !! :)


Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: budduke on June 03, 2010, 12:57:08 AM
@ batu544,

This Mod sure has taken a life of its own. Everyone has come up with some pretty neat additions to it, this one also...

let me answer the 2 question first, I do not know anything about .htaccess files, my provider does not support them so I have not looked into them. Hopefully someone else can help you there. The only thing that they may have a hard time would be knowing the multi_down_select=8 is equal to 1280X800. good luck on that one.

the other request, yes, it should be possible. I can make it do a formula on the image to gets its ratio and only display sizes that fall into the same ratio. The only downside to that would be if you/or a user uploaded an image that was 1280X799 instead of 1280X800 then none of the selections would match. The sizes would have to be an exact ratio match.

Another way that I may be able to do would be to allow only certain groups to be available depending on the category they are in.
In other words, you would have a wide screen category and only be able to use sizes in group3 and another category for group1 and then those options would be the only ones available. I may be able to make it so you can choose more then one group per category, like group2 and 3 for a category.

My question would be, would it be better to do this image by image or by category?

I have some other things on my plate but will play with the mod some more to see what I can do,

I added a poll to this thread if everyone can choose which way they would prefer it to work...
Title: Re: [MOD] Multi Size Download of same image [ver 4.1]
Post by: batu544 on June 03, 2010, 06:01:25 AM
Hi budduke,
                   Its great to know that its doable :) . I think image ratio approach will be a good option. May be following ratio details will help you..

Code: [Select]
"wide" => "1.6",
"normal" => "1.33",
"iphone" => "0.67",
"normal5.4" => "1.25",
"HD" => "1.78",
"multi4.3" => "2.67",
"multi16.5" => "3.2",
"other" => "0"

Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on June 06, 2010, 09:59:22 PM
@batu544,

Have just updated it to version 4.2 which includes what you were asking for...
Let me know how it works.
You will see that you only have to replace 2 inserts with the updated ones..
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on June 09, 2010, 09:57:38 PM
budduke,
                 I just implemented this MOD in my website.. and it works fine also..

Thank you for this mod.. :)


batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on June 11, 2010, 05:55:21 PM
Hi,
    A small issue, I noticed in my website..  When I am selecting the Original size Its not opening in the new window..  :(


Could you please let me know what needs to be changed for this ?

Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on June 12, 2010, 04:21:26 PM
Hi,
    A small issue, I noticed in my website..  When I am selecting the Original size Its not opening in the new window..  :(


Could you please let me know what needs to be changed for this ?

Thanks,
batu544


I little oversight on my part...
I have changed my original post to include this change but if you already have the mod installed...

in your includes\functions.php file...

find
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'>".$lang['original_size']."</a>";replace with
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'".$multi_download_var['target'].">".$lang['original_size']."</a>";
find
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";replace[/b[ with
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'".$multi_download_var['target']."><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on June 12, 2010, 08:38:54 PM
Thanks budduke.. now everything is okay.. :)

Just a thought.. if it can be possible..


Now, while selecting to open the resized image ... its only opening the image in a new window..  It will be better if we can make a template for this... so that may be we can add little header, title, keyword and description tags for better SEO..

Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on June 14, 2010, 03:02:09 PM
Thanks budduke.. now everything is okay.. :)

Just a thought.. if it can be possible..


Now, while selecting to open the resized image ... its only opening the image in a new window..  It will be better if we can make a template for this... so that may be we can add little header, title, keyword and description tags for better SEO..

Thanks,
batu544


My thought is that when a user clicks on the download button, they should get the image they are asking for and not more pages with ads and information, they just want the file.
So my answer would be no. If you are set on making another page, you can add to the echo command from the insert in the download.php file. that will echo all the sruff you want to display on that popup. but no, my mod stops there.
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: SilverShadow on June 21, 2010, 05:15:48 PM
Nothing to say but Hats Off :) Really highly appreciated.
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on June 23, 2010, 06:49:03 PM
Hi budduke,
                   Found a bug..  After installing this mod.. if I am not using the multi download option for category and using the normal download button.. then instead of downloading the image.. the image just opens in the same window....


it would be great if you find a fix for this.. !!

Thanks,
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on June 24, 2010, 01:23:07 AM
Found a bug..  After installing this mod.. if I am not using the multi download option for category and using the normal download button.. then instead of downloading the image.. the image just opens in the same window....

In your download.php file
find
Code: [Select]
//MOD multi download for popup window
if ($multi_download_var['target']<>""){
echo "<img src='".$file['file_path']."'/>";
}
else{
        send_file($file['file_name'], $file['file_path']);
    }
//END MOD multi download for popup window

Replace with...
Code: [Select]
//MOD multi download for popup window
if (($multi_download_var['target']<>"") && $size){
echo "<img src='".$file['file_path']."'/>";
}
else{
send_file($file['file_name'], $file['file_path']);
}
//END MOD multi download for popup window

I also noticed that it does the same thing when you select original image...
this should fix this problem...
in your includes/functions.php file...
find
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'>".$lang['original_size']."</a>";replace with...
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."' ".$multi_download_var['target'].">".$lang['original_size']."</a>";
find
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";replace with...
Code: [Select]
$multi_download_options .= "<a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."' ".$multi_download_var['target']."><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";
Let me know if that fixes it and I will update my original post...
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on June 24, 2010, 04:49:18 AM
budduck -
                Download.php changes worked for me.. I have not applied the function.php because for me everything looks okay.. ( original size also works fine because I already have applied some fix which was posted earlier ) ..


Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on July 02, 2010, 01:59:23 PM
Hi Budduck.. !!
                         I am back again with a request .. :) 

Now, If I am accessing the download url directly .. then its showing me an error message "Hotlinking is not allowed", Can it be possible to stop this error message and display the actual image what user has requested.. ??


Thanks
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on July 03, 2010, 08:26:09 PM
@ batu544,
I looked around your site and did not see this error anywhere...
Most of the time when I have seen this error, it is because of something not being correct in the .htaccess file but I do not work with them to help you fix the problem.

I did see your post with V@no regarding my mod not using the site_sess->url correctly,
I am currently fixing my user category mod to hopefully work correctly with the sessions and then I will be tackling this mod to see if that may be your issue or not.

Sorry I could not be of more help,
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: V@no on July 03, 2010, 09:53:32 PM
I am currently fixing my user category mod to hopefully work correctly with the sessions and then I will be tackling this mod to see if that may be your issue or not.

A little tip to make it fully compatible with integrations and avoid common mistakes, in case you didn't know:
- url passing to $site_sess->url() functions must have & not &amp;
- url queries for image_id, user_id, cat_id, etc should be replaced by constants URL_IMAGE_ID, URL_USER_ID, etc (refer to includes/constants.php)
for example line:
$multi_download_group .="<td align='center'><a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";


should look like this:
$multi_download_group .='<td align="center"><a href="'.$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var).'"'.$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on July 04, 2010, 12:21:31 AM
V@no -
            Do you think putting &amp; in the url() function will cause a problem ?? I have not done this changes but still its working.. and also I noticed there is a line in the url() function..
Code: [Select]
$url = str_replace('&amp;', '&', $url);

Is this not to replace &amp; with '&' ??


Budduke -
                   The Hot link error message comes in, if one person is bookmarking one image download page and he comes later to visit that page. For example if you will visit this page now then you will get the hotlink error message

http://www.bhwallpapers.com/download-kim-kardashian-20592-13-1280x800.htm

but if you will visit the same page by visiting wallpapers detail page --> download page.. it will not give you any error message..

The error message comes up from the following lines of code in download.php

Code: [Select]
    if (!check_download_token($image_row['image_id'])) {
      echo "Hotlinking is not allowed";
  exit;
  redirect("index.php");
    }


Thanks
batu544

Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: budduke on July 04, 2010, 12:42:14 AM
@ batu544,

I think this should fix your problem...
http://www.4homepages.de/forum/index.php?topic=23530.0 (http://www.4homepages.de/forum/index.php?topic=23530.0)

I believe 4images does this by design, to stop other sites from using your bandwidth by directly linking to your download images and not going through your details page.

Your download image page is unique in that it still has ads on it. If you are going to allow other sites to link this way to you, you should put something like...
"To see more images like this visit my main site at Bollywood Hollywood Celebrity wallpapers (with a link)"
Just a thought...

@ V@no,
Thank for the input, like usual, I do forget about the constants. Am currently waiting to see how my fix worked on my other mod before working on this one again.
I do not really understand how the site_sess->url() works but all I know is that it does work. It added the &l=language on all the links on my other mod but not sure how...
Maybe someday I will understand it better.
Thanks again!
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: V@no on July 04, 2010, 01:33:59 AM
            Do you think putting &amp; in the url() function will cause a problem ?? I have not done this changes but still its working..
It could cause problems with a SEO mod.

and also I noticed there is a line in the url() function..
Code: [Select]
$url = str_replace('&amp;', '&', $url);
There is no such line in fresh 4images ;)


As of hotlinking, you have two options:
1) disable hotlinking protection:
in includes/functions.php find:
function check_download_token($token) {
insert below:
  return true;

2) simple redirect to image details page:
in download.php replace:
      echo "Hotlinking is not allowed";
with:
      redirect("details.php?".URL_IMAGE_ID."=".$image_row['image_id']);
Title: Re: [MOD] Multi Size Download of same image [ver 4.2]
Post by: batu544 on July 04, 2010, 07:43:12 AM
V@no -
            I used option 1 .. :) and its working fine..

and you are correct the above lines of code is not in the fresh 4image installation, but its actually a part of the Google Friendly Urls For 4images Best Seo Mod.


Thanks
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on July 04, 2010, 06:47:26 PM
The problem with the sessions should be fixed now with version 4.3 of my mod.
you only have to replace one insert area of my code to fix the problem.
Sorry about that...

Thank V@no for your input!

I am still learning from the best  :D
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: batu544 on July 07, 2010, 08:04:22 AM
Hi Budduke,
                     I had a discussion with V@no regarding one change and as per V@no, this can be done by you :)

For details about the question..  ==> http://www.4homepages.de/forum/index.php?topic=17598.msg148750#msg148750


For suggested solution ==> http://www.4homepages.de/forum/index.php?topic=17598.msg148764#msg148764
Quote
@batu544:
The problem is, neither the multi size download, nor this mod has actual image dimensions.
I think your best bet would be ask budduke to add additional item into $download_multi_sizes array that would temporary hold original image dimensions.


Is it doable ?

Thanks,
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on July 08, 2010, 12:11:12 AM
@batu544 and V@no,
Not sure what you are asking?
In the $download_multi_sizes array...
the first variable is what is displayed
the second variable is the x dimension
the third variable is the y dimension

The image dimensions are already there  :?

For the original image, it is choosing the next variable in the array that actually does not exist so the code knows to pull the original file instead.
Are you wanting one more variable with the x&y dimensions of the original file in it for some reason? That may be possible but would have to rewrite some of the code to make it work.

Let me know more what you are trying to accomplish and then I will go from there...

UPDATE:
Reread your other posts and I wonder if it could be this easy?
in your includes/functions.php file
look for
Code: [Select]
$varcount= count($download_multi_sizes);Replace with
Code: [Select]
//$varcount= count($download_multi_sizes);
$original_number=30;//Make this # the same as what shows up in the link for 'original size' after 'multi_download_select='
$download_multi_sizes[$original_number][0]=$lang['original_size'];
if ($detailed_view){
$download_multi_sizes[$original_number][1]=$max_width;
$download_multi_sizes[$original_number][2]=$max_height;
}
$varcount= count($download_multi_sizes)-1;

Make sure you change the original_number to what you need on your site...

It seems to work on my test site but I am worried about all the random images on your details page because this is called each time but I think I made sure only the main one will be stored and not any of the other thumbnails...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: V@no on July 09, 2010, 02:22:24 AM
No, it's not that, your addon doesn't get any information about the image itself, batu544 asked for actual image dimensions.
And besides, I think this additional code will break your mod, because you don't have static number for original size, you are using the count($download_multi_sizes) for the original size. So, if you have 29 items in that array, then number 30 would be original and then if you add key 30 into that array with info about original image, then count($download_multi_sizes) will return 31, which will make original image size 31 not 30 (IMO it's a flaw of this mod ;))
If I may suggest, instead of using dynamic number for original image, use static, such as 0:
$download_multi_sizes= array(
array('0x0',0,0), //original image, the numbers don't matter
array('group1',0,0), //Groups are created in this format, group1 name is associated with a language entry with the same name (the 0,0 is important!)

and then use $var=1; to skip original array key..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on July 09, 2010, 02:37:32 PM
@ V@no,
Actually, It doesn't break the code in any way because on the count, I subtracted one from it so it will not get in the way.
When the mod first started way back when, it did not have original size in it so it was added after the original code. I guess sometimes it is better to start the code all over then to keep patching the one already made. If I put the original as the first variable, that is asking for a user to mess it up in some way but this way they do not see it is there.
I may implement it into the mod because then I could have the original image size displayed next to the word in case someone sees a need for it.

Thanks for you help and advice and it looks like Batu544 has the problem taken care of...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on September 26, 2010, 02:27:11 PM
i'm getting this on detail page.

Code: [Select]
DB Error: Bad SQL Query: 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, c.cat_name, u.user_name, u.user_email, c.multi_downloadage_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name, u.user_email FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_id = 2 AND i.image_active = 1 AND c.cat_id = i.cat_id
Unknown column 'c.multi_downloadage_votes' in 'field list'

Warning: Cannot modify header information - headers already sent by (output started at /home/fun/public_html/includes/db_mysql.php:190) in /home/fun/public_html/includes/functions.php on line 114
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on September 26, 2010, 09:24:06 PM
@ khansahib,

I am not sure if the warning is a result of the DB error but you whould recheck all the SQL changes that you did for this mod.
I do know that there is no category called 'c.multi_downloadage_votes'
It looks like you may have copy/pasted over something else. I would think it should be 'c.multi_download' and not sure about how the age_votes should look.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on September 26, 2010, 09:36:37 PM
well sir i've installed your mod on fresh copy of 4images 1.7.8
i've checked each and every file 2 times.. nothing wrong with copy paste..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: V@no on September 26, 2010, 10:15:46 PM
well sir i've installed your mod on fresh copy of 4images 1.7.8
i've checked each and every file 2 times.. nothing wrong with copy paste..
check 3nd time, because you messed up the first change in details.php. Looks like you replaced only part of the line

@budduke:
see, it's hard to explain exactly which step to look at, when there is no numbered steps in the instructions ;)
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on September 26, 2010, 11:48:31 PM
@ khansahib,
If you could post a zip file with your changed files, I will take a look at them and compare them with mine to see what went wrong...

@ V@no,
Thanks,
I always take the hard road  :oops:
Never thought soo many people would be using my Mods, kinda like the attention but will have to do better on documenting it all in the future...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on September 27, 2010, 05:06:25 AM
Well Sir V@no, i checked 2 times again, in total 4 now...  :|

now i hope Mr. budduke find wt i didn't in 4 times :(

here is link to my files..
Code: [Select]
http://hotfile.com/dl/71986019/d264269/Multi_size_Mod.zip.html
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: V@no on September 27, 2010, 05:30:22 AM
Ok, now compare:

1. The original line
2. The line that you should have after the modification
3. The line that you actually have
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").", c.multi_download
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").", c.multi_downloadage_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email")."



See the difference?
You've replaced part of the line, not entire line.
I hope you didn't do the same to other steps...it would be very hard to trace the problem if you did..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on September 27, 2010, 07:28:16 AM
Thanks V@no, I fixed it..
its working fine now :)
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: izarkov on November 30, 2010, 12:21:14 AM
Hi,

I am with version 1.7.9,

Can I install this mod in this version, and if it is possible,
please send instructions ,  :roll:

I need this modul. It`s very functional.

Thanks

Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on November 30, 2010, 12:37:37 AM
Hi,

I am with version 1.7.9,

Can I install this mod in this version, and if it is possible,
please send instructions ,  :roll:

I need this modul. It`s very functional.

Thanks

I looked through the changes that were made in the newer versions of 4images and did not see anything that stood out as a problem but I have not installed the mod on 1.7.9 to tell you that everything is fine.
The instructions would be the step-by-step that is in the first post in this topic.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: chintan100 on November 30, 2010, 09:16:14 AM
Hi budduke,

It is a great mod! Thank you for all the hardwork! :mrgreen:

I have some problems with it though:

I am running 1.7.8. My site: http://www.lotofwallpapers.com.

1. When i select "Yes, Allow all sizes to be selectable" from CP for a category, on every page on the site, i get a bunch of warnings:

Code: [Select]
[29-Nov-2010 15:18:10] PHP Warning:  Division by zero in .../public_html/lotofwallpapers.com/includes/functions.php on line 629
[29-Nov-2010 15:18:10] PHP Warning:  Division by zero in .../public_html/lotofwallpapers.com/includes/functions.php on line 629
[29-Nov-2010 15:18:10] PHP Warning:  Division by zero in .../public_html/lotofwallpapers.com/includes/functions.php on line 629
[29-Nov-2010 15:18:10] PHP Warning:  Division by zero in .../public_html/lotofwallpapers.com/includes/functions.php on line 629
[29-Nov-2010 15:18:10] PHP Warning:  Cannot modify header information - headers already sent by (output started at /home/chintanp/public_html/lotofwallpapers.com/includes/functions.php:620) in /home/chintanp/public_html/lotofwallpapers.com/includes/functions.php on line 114

That line is:
 if (((($max_width/$max_height)==($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2]))&&($multi_download_var['ratio']))||(!$multi_download_var['ratio'])){


This problem only happens with "Yes, Allow all sizes to be selectable" and not with "Yes, Only allow smaller sizes then original to be selectable".

I tested it a bit and found that the problem is only in $max_width/$max_height division and not in $download_multi_sizes[$var][1]/$download_multi_sizes[$var][2].

I echoed all the 4 variables and found that none of them were 0.
 
2. Also, when i have a large image displayed (for ex. http://lotofwallpapers.com/img-nature705-11.htm) whose dimensions are 1920X1080, the options shown are only of mobile and blackberry and not any others like 800x600, 1024x768 etc which should also be shown with ""Yes, Only allow smaller sizes then original to be selectable" selected. Those other options 800x600, 1024x768 etc do appear when i select "Yes, Allow all sizes to be selectable" but i get those dreaded warnings with that selected.

3. I read all the previous posts and somewhere you mentioned that you were looking into providing cropping not based on aspect ratio but on exact dimensions selected. Is it already included in 4.3? Because when i select 320x240 from the Blackberry list, i always get an image which is 320x180.

I am attaching my functions.php file if it can help.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: izarkov on November 30, 2010, 05:05:50 PM
Hi

I use 1.7.9 version, and i make everyting step by step from port 1, and there is error:


Parse error: parse error in C:\wamp\www\ImageBank\includes\template.php(101) : eval()'d code on line 147

Could you please help me.... :(
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 01, 2010, 12:22:32 AM
@ chintan100,
attached is your functions.php file with some changes that I saw when I compared with my own file.
Let me know if this fixes it or not.
Your question #3 about cropping, look for this variable in your global.php file
Quote
$multi_download_var['crop']=0; //crop image after resize  (see below)
/*    what crop will do is resize image larger then size that is asked for unless it detects it will resize without and extra space.
   then it will crop off the extra area to give you the actual size asked for (loosing part of your image)
   0= do not crop
   1= crop equally on both sides
   2= crop top or left side
   3= crop bottom or right side
   4= resize and stretch to fit requested size (no crop)
*/

UPDATE:
Anyone having division by zero errors using this mod, you will need to make the following change...
in your includes/functions.php file...
look for...
Code: [Select]
// MOD multi download
$sql = "SELECT multi_download
        FROM ".CATEGORIES_TABLE."
        WHERE cat_id = ".$image_row['cat_id']." ";
$result = $site_db->query_firstrow($sql);
$multi_download = $result['multi_download'];
if ($multi_download){
if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_colvar = 0;
if ($multi_download_var['show_table']){
$multi_download_class1 = "class='head1'";
$multi_download_class2 = "class='row1'";
$multi_download_class3 = "class='row2'";
}
else {
$multi_download_class1 = "";
$multi_download_class2 = "";
$multi_download_class3 = "";
}
$multi_download_group0 = ($multi_download_var['center_groups'] ? "align='center'" : "");
// change the code below to change how your monitor resolution is displayed
$multi_download_resolution = "<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'><B>".$lang['multi_resolution']."<script type='text/javascript'>document.write(screen.width+'X'+screen.height)</script></B></TD></TR>";
if ($multi_download_var['bold_groups']){
$multi_download_group1= "<B>";
$multi_download_group2= "</B>";
}
else{
$multi_download_group1= "";
$multi_download_group2= "";
}
if (!$multi_download_var['type']){
$multi_download_options = "<BR><BR><form action='".$site_sess->url(ROOT_PATH."download.php")."' method='post'".$multi_download_var['target']."><table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."'  ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .="<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD></TR>";
}
$multi_download_options .="<TR ".$multi_download_class2."><TD><select name='multi_download_select'>";
}
else{
$multi_download_options = "<table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."' ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .= "<tr ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD>";
}
}
$var=0;
$down_group=0;
$down_group_flag=0;
$multi_download_group="";
$multi_download_colvar=0;
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {
$max_width = $site_template->val_cache['width'];
$max_height = $site_template->val_cache['height'];
}
$varcount= count($download_multi_sizes);
while ($var < $varcount){
if ($download_multi_sizes[$var][1] == '0'){
if ((!$down_group) && ($multi_download_group<>"")){
if (!$multi_download_var['type']) {
$multi_download_options .=$multi_download_group;
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
$multi_download_options .= "<tr ".$multi_download_class2.">".$multi_download_group."</tr>";
}
}
if ($down_group && $down_group_flag){
if (!$multi_download_var['type']) {
$multi_download_group .= "</optgroup>";
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
}
$multi_download_options .= $multi_download_group;
}
$down_group=1;
$down_group_flag=0;
if (!$multi_download_var['type']) {
$multi_download_group ="<optgroup label='".$lang['multi_down_'.$download_multi_sizes[$var][0]]."'>";
}
else{
$multi_download_group ="</tr><tr ".$multi_download_class3."><td colspan='".$multi_download_var['columns']."' ".$multi_download_group0.">".$multi_download_group1.$lang['multi_down_'.$download_multi_sizes[$var][0]].$multi_download_group2."</TD></TR><tr ".$multi_download_class2.">";
$multi_download_colvar = 0;
}
}
else{
if ((($download_multi_sizes[$var][1] <= $max_width && $download_multi_sizes[$var][2] <= $max_height)&&($multi_download =='2'))||($multi_download=='1')){
  if (((($max_width/$max_height)==($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2]))&&($multi_download_var['ratio']))||(!$multi_download_var['ratio'])){
switch($multi_download_var['type']){
case (1) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
break;
case (2) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target']."><img src='".get_gallery_image($download_multi_sizes[$var][0].".".$multi_download_var['button'])."' ";
if ($multi_download_var['alt_image']){
$multi_download_group .= "alt='".$download_multi_sizes[$var][0]."' ";
}
$multi_download_group .="border='0'></a></td>";
break;
case (0) :
default:
$multi_download_group .="<option value='".$var."'>".$download_multi_sizes[$var][0]."</option>";
break;
}
$down_group_flag=1;
$multi_download_colvar++;
  }
}
if (($multi_download_colvar == $multi_download_var['columns']) && ($multi_download_var['type']>0)){
$multi_download_colvar = 0;
$multi_download_group .="</tr><tr ".$multi_download_class2.">";
}
}
$var++;
}
if (($down_group==1) && (!$multi_download_var['type'])){
$multi_download_group .="</optgroup>";
}
if($down_group_flag){
$multi_download_options .=$multi_download_group;
}else{
$multi_download_colvar = 1;
}
$multi_download_colvar2= $multi_download_colvar;
$multi_download_colvar = $multi_download_var['columns'] - $multi_download_colvar;
if ($multi_download_var['center_original']){
$multi_download_colvar1= $multi_download_colvar;
}
else{
$multi_download_colvar1= 1;
$multi_download_colvar--;
}
switch ($multi_download_var['type']){
case(1):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target'].">".$lang['original_size']."</a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(2):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target']."><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";
if($multi_download_var['alt_image']){
$multi_download_options .= "alt='".$lang['original_size']."' ";
}
$multi_download_options .="border='0'></a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(0):
default:
if ($multi_download_var['show_original']){
$multi_download_options .="<option value='".$var."'>".$lang['original_size']."</option>";
}
$multi_download_options .="</select>";
$multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
</TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
<input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
break;
}
$allow_download = 1;
set_download_token($image_row['image_id']);
}
$site_template->register_vars("multi_download_options", $multi_download_options);
unset($multi_download_options);
}

// END MOD multi download

Replace with
Code: [Select]
// MOD multi download
$sql = "SELECT multi_download
        FROM ".CATEGORIES_TABLE."
        WHERE cat_id = ".$image_row['cat_id']." ";
$result = $site_db->query_firstrow($sql);
$multi_download = $result['multi_download'];
if ($multi_download){
if (!check_permission("auth_download", $image_row['cat_id'])) {
$multi_download_options="&nbsp;&nbsp;<img src=\"".get_gallery_image("download_off.gif")."\" border=\"0\" alt=\"\" />";
$allow_download = 0;
clear_download_token($image_row['image_id']);
}
else{
$multi_download_colvar = 0;
if ($multi_download_var['show_table']){
$multi_download_class1 = "class='head1'";
$multi_download_class2 = "class='row1'";
$multi_download_class3 = "class='row2'";
}
else {
$multi_download_class1 = "";
$multi_download_class2 = "";
$multi_download_class3 = "";
}
$multi_download_group0 = ($multi_download_var['center_groups'] ? "align='center'" : "");
// change the code below to change how your monitor resolution is displayed
$multi_download_resolution = "<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'><B>".$lang['multi_resolution']."<script type='text/javascript'>document.write(screen.width+'X'+screen.height)</script></B></TD></TR>";
if ($multi_download_var['bold_groups']){
$multi_download_group1= "<B>";
$multi_download_group2= "</B>";
}
else{
$multi_download_group1= "";
$multi_download_group2= "";
}
if (!$multi_download_var['type']){
$multi_download_options = "<BR><BR><form action='".$site_sess->url(ROOT_PATH."download.php")."' method='post'".$multi_download_var['target']."><table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."'  ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .="<TR ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD></TR>";
}
$multi_download_options .="<TR ".$multi_download_class2."><TD><select name='multi_download_select'>";
}
else{
$multi_download_options = "<table border='0' cellspacing='1' cellpadding='0' width='".$multi_download_var['table']."' ".$multi_download_class1."><tr><td><table border='0' cellspacing='0' cellpadding='0' width='".$multi_download_var['table']."'>";
if ($multi_download_var['show_resolution']){
$multi_download_options .= $multi_download_resolution;
}
if ($multi_download_var['download']){
$multi_download_options .= "<tr ".$multi_download_class3."><TD colspan='".$multi_download_var['columns']."' align='center'>".$lang['multi_select']."</TD>";
}
}
$var=0;
$down_group=0;
$down_group_flag=0;
$multi_download_group="";
$multi_download_colvar=0;
if (ISSET($site_template->val_cache['download_width'])){
$max_width = $site_template->val_cache['download_width'];
$max_height = $site_template->val_cache['download_height'];
}
else {
$max_width = $site_template->val_cache['width'];
$max_height = $site_template->val_cache['height'];
}
$varcount= count($download_multi_sizes);
while ($var < $varcount){
if ($download_multi_sizes[$var][1] == '0'){
if ((!$down_group) && ($multi_download_group<>"")){
if (!$multi_download_var['type']) {
$multi_download_options .=$multi_download_group;
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
$multi_download_options .= "<tr ".$multi_download_class2.">".$multi_download_group."</tr>";
}
}
if ($down_group && $down_group_flag){
if (!$multi_download_var['type']) {
$multi_download_group .= "</optgroup>";
}
else{
if ($multi_download_colvar < $multi_download_var['columns']){
$multi_download_colvar1=($multi_download_var['columns'] - $multi_download_colvar);
$multi_download_group .= "<td align='center' colspan='".$multi_download_colvar1."'></td>";
}
}
$multi_download_options .= $multi_download_group;
}
$down_group=1;
$down_group_flag=0;
if (!$multi_download_var['type']) {
$multi_download_group ="<optgroup label='".$lang['multi_down_'.$download_multi_sizes[$var][0]]."'>";
}
else{
$multi_download_group ="</tr><tr ".$multi_download_class3."><td colspan='".$multi_download_var['columns']."' ".$multi_download_group0.">".$multi_download_group1.$lang['multi_down_'.$download_multi_sizes[$var][0]].$multi_download_group2."</TD></TR><tr ".$multi_download_class2.">";
$multi_download_colvar = 0;
}
}
else{
if ($max_width && $max_height){
if ((($download_multi_sizes[$var][1] <= $max_width && $download_multi_sizes[$var][2] <= $max_height)&&($multi_download =='2'))||($multi_download=='1')){
  if (((($max_width/$max_height)==($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2]))&&($multi_download_var['ratio']))||(!$multi_download_var['ratio'])){
switch($multi_download_var['type']){
case (1) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
break;
case (2) :
$multi_download_group .="<td align='center'><a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."'".$multi_download_var['target']."><img src='".get_gallery_image($download_multi_sizes[$var][0].".".$multi_download_var['button'])."' ";
if ($multi_download_var['alt_image']){
$multi_download_group .= "alt='".$download_multi_sizes[$var][0]."' ";
}
$multi_download_group .="border='0'></a></td>";
break;
case (0) :
default:
$multi_download_group .="<option value='".$var."'>".$download_multi_sizes[$var][0]."</option>";
break;
}
$down_group_flag=1;
$multi_download_colvar++;
  }
}
if (($multi_download_colvar == $multi_download_var['columns']) && ($multi_download_var['type']>0)){
$multi_download_colvar = 0;
$multi_download_group .="</tr><tr ".$multi_download_class2.">";
}
}
}
$var++;
}
if (($down_group==1) && (!$multi_download_var['type'])){
$multi_download_group .="</optgroup>";
}
if($down_group_flag){
$multi_download_options .=$multi_download_group;
}else{
$multi_download_colvar = 1;
}
$multi_download_colvar2= $multi_download_colvar;
$multi_download_colvar = $multi_download_var['columns'] - $multi_download_colvar;
if ($multi_download_var['center_original']){
$multi_download_colvar1= $multi_download_colvar;
}
else{
$multi_download_colvar1= 1;
$multi_download_colvar--;
}
switch ($multi_download_var['type']){
case(1):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target'].">".$lang['original_size']."</a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(2):
if ($multi_download_var['newline_original']){
if ($multi_download_colvar2){
$multi_download_colvar1 = $multi_download_var['columns'] - $multi_download_colvar2;
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'></td>";
$multi_download_options .="</tr><tr ".$multi_download_class2.">";
}
if ($multi_download_var['center_original']){
$multi_download_colvar1=$multi_download_var['columns'];
}
else{
$multi_download_colvar1 =1 ;
$multi_download_colvar=$multi_download_var['columns'];
}
}
$multi_download_options .="<td align='center' colspan='".$multi_download_colvar1."'>";
if ($multi_download_var['show_original']){
$multi_download_options .= "<a href='".$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var)."' ".$multi_download_var['target']."><img src='".get_gallery_image("original_size.".$multi_download_var['button'])."' ";
if($multi_download_var['alt_image']){
$multi_download_options .= "alt='".$lang['original_size']."' ";
}
$multi_download_options .="border='0'></a>";
}
$multi_download_options .= "</td>";
if (!$multi_download_var['center_original']){
$multi_download_options .= "<td colspan='".$multi_download_colvar."'></td>";
}
$multi_download_options .="</tr></table></td></tr></table>";
break;
case(0):
default:
if ($multi_download_var['show_original']){
$multi_download_options .="<option value='".$var."'>".$lang['original_size']."</option>";
}
$multi_download_options .="</select>";
$multi_download_options .= "</td><td><input type='submit' name='download' value='".$lang['download']."' class='button' />
</TD></TR></TABLE></TABLE><input type='hidden' name='action' value='resize' />
<input type='hidden' name='image_id' value='".$image_row['image_id']."' /></form>";
break;
}
$allow_download = 1;
set_download_token($image_row['image_id']);
}
$site_template->register_vars("multi_download_options", $multi_download_options);
unset($multi_download_options);
}

// END MOD multi download

I will update my original post as soon as I have tested this change completely to make sure there are no other problems...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: chintan100 on December 01, 2010, 10:25:35 AM
Hi budduke!

The first 2 problems are solved! Thank you very much for your work.  :mrgreen:

For the 3rd problem, i found something interesting. I cleared cache using your plugin and most of the images resized correctly in the selected ratio. But for this image: http://lotofwallpapers.com/img-nature-1-1.htm, when you select 320x480, the image shown in the new window is always 320x180. However, if we enter the direct path to the image in the browser: http://lotofwallpapers.com/data/media/2/big/1__resized_320x480.jpg, the image is correctly 320x480.  8O . This always happens no matter how many times i clear the cache of resized images.

I have set $multi_download_var['crop']=4 (4= resize and stretch to fit requested size (no crop))
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 01, 2010, 02:59:30 PM
@ chintan100,
I have tried it on 2 different computers, firefox, IE8, and chrome, and it looks fine to me
I even pulled the image into photoshop to make sure the dimensions were correct.

I think you have a local problem with your computer
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: chintan100 on December 01, 2010, 03:03:50 PM
Surprisingly, it is working fine now by itself!  8O

Sorry for bothering you.

Thank you for all your support.  :D
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 24, 2010, 05:39:37 PM
can this option "Yes, Only allow smaller sizes then original to be selectable" be selected for all categories and sub-categories by default??
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 25, 2010, 01:32:37 AM
can this option "Yes, Only allow smaller sizes then original to be selectable" be selected for all categories and sub-categories by default??

Not as the Mod was written, but you can try these SQL commands in your database admin utility.
Make sure you backup your database first. I have not tested these commands, but they should work.

This code will set all new categories default value set to this value...
Code: [Select]
ALTER TABLE 4images_categories ALTER [COLUMN] multi_download SET '2'
This code will change all your current categories to this value...
Code: [Select]
UPDATE 4images_categories SET multi_download = '2'
Will keep this in mind on the next revision of this mod...

Hope this fixes it for you.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 25, 2010, 09:43:02 AM
Code: [Select]
ALTER TABLE 4images_categories ALTER [COLUMN] multi_download SET '2'
i got this
Code: [Select]
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[COLUMN] multi_download SET '2'' at line 1

Code: [Select]
UPDATE 4images_categories SET multi_download = '2' this one worked well and updated all categories..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 25, 2010, 10:14:38 PM
@ khansahib,

My bad...
The first one should read...
Code: [Select]
ALTER TABLE 4images_categories ALTER COLUMN multi_download SET DEFAULT 2
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 26, 2010, 05:48:53 AM
well it executed successfully.
"Your SQL query has been executed successfully"

but when i tried to add a new category same "No" was selected by default.

Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 26, 2010, 04:46:12 PM
well it executed successfully.
"Your SQL query has been executed successfully"

but when i tried to add a new category same "No" was selected by default.



Oh man, my brain is not working to well today... Sorry.

Look for the insert that I had the Mod put into the admin/categories.php file
Code: [Select]
// MOD Multi Download
  $multi_download = (isset($HTTP_POST_VARS['multi_download'])) ? intval($HTTP_POST_VARS['multi_download']) : 0;
// END MOD Multi download

Replace the 0 with a 2 and you should be good.
Remember, you have to do this in two places in that file
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 26, 2010, 06:02:32 PM
sorry dude.. it didn't work Same "No" is selected by default and i've changed in both places as u said..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 26, 2010, 10:36:51 PM
sorry dude.. it didn't work Same "No" is selected by default and i've changed in both places as u said..

It has been awhile since I have worked on this mod...
I had to open my test site back up on it and now I see what you are talking about...
I did get it to work be re-writing the code that I placed in the admin/categories.php file but I do not feel comfortable giving the directions because people can make mistakes with it pretty easy.
I will include this change in the next release, but for you,
if you can zip your admin/categories.php file and attach it, I will make the modifications to it and maybe others with the same problem can see what I did to fix yours...

sorry for the troubles,
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 27, 2010, 03:03:16 AM
Thanks for replying..
i've attached the file u asked for..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on December 27, 2010, 03:26:34 PM
Thanks for replying..
i've attached the file u asked for..

This should solve your problem. Also, if you create a sub-category, it will pull hte settings from the parent category like it should also.
I have set the default value to be what you asked for. Look in the code to see where you can change it is you need to.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: khansahib on December 27, 2010, 04:15:08 PM
thanks alot bro.. its working welll :)
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wianet on February 10, 2011, 11:07:19 PM
Hello! Sorry, i only speak very little English. I use this excellent MOD on the site, but in one browser (opera.com) there was a problem at photo downloading. The photo is loaded in a format .html. Please, help me.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on February 11, 2011, 12:20:26 AM
Hello! Sorry, i only speak very little English. I use this excellent MOD on the site, but in one browser (opera.com) there was a problem at photo downloading. The photo is loaded in a format .html. Please, help me.

In future, post your question in your native language, I can google translate.
I downloaded the latest opera browser 11 and this is what it looked like when I went to select a size to download.
(see attached image for what my screen looked like)
It sees it as a jpeg and not html. If it opens it in the opera browser it is still a jpeg image when you right click on it and say save image.

I would start by trying a different computer to see if it is a setting on the computer you are using.

Do you have a link where I can see the problem in action?
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wianet on February 11, 2011, 09:42:12 AM
Forgive, I have found out that a problem not in yours mod. A problem in incorrect definition mime-types. Demo site - ginrus.ru. How to rectify this error of browser opera? :(
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on February 12, 2011, 01:05:35 AM
Forgive, I have found out that a problem not in yours mod. A problem in incorrect definition mime-types. Demo site - ginrus.ru. How to rectify this error of browser opera? :(

To change the default actions in Opera...
go to "tools"
"Preferences"
"advanced"
"download"
un-check the box next to "hide file types opened with Opera"
Then look for "jpg" and click on edit...

I think that is what you are asking...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wianet on February 12, 2011, 10:29:10 AM
To me has helped here that:
in a file download.php
header("Content-Type: application/octet-stream\n");
replace
header("Content-Type: application/octet-stream/jpeg\n");
Now opera downloads correctly.
Thanks you budduke for the help and good MOD  :)
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: batu544 on February 25, 2011, 07:21:34 AM
Hi budduke

                           I am back again with one more request with your MOD..  :) 

Here is the question.. Is it possible to add the watermark to all resized images ?

May be you can use the existing annotate.php file so that, the annotation setting can be controlled by the admin panel.


Thank you.
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on February 27, 2011, 09:08:20 PM
Hi budduke

                           I am back again with one more request with your MOD..  :) 

Here is the question.. Is it possible to add the watermark to all resized images ?

May be you can use the existing annotate.php file so that, the annotation setting can be controlled by the admin panel.


Thank you.
batu544

Which watermark mod are you currently using? There may be a way of linking them together...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: batu544 on February 28, 2011, 04:58:03 AM
Hi
    I am using the watermark MOD which is done by V@no.. ==>   http://www.4homepages.de/forum/index.php?topic=13719.0




Thanks
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 03, 2011, 09:24:14 PM

    I am using the watermark MOD which is done by V@no.. ==>   http://www.4homepages.de/forum/index.php?topic=13719.0
:?: :?: :?:
I have not installed that mod yet but looking through the code and inserts in it,
It looks to me like it creates the watermark as the original file is being uploaded to the server, either by admin or end users, and is applied to the original file.
At that point my mod would just resize that original image with the watermark already there...
Or am I misreading the mod?

I may have time this weekend to play with it more...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: batu544 on March 04, 2011, 11:59:13 AM
Hi,
     Yes, you are correct. This mod applies the water mark to the original image.   

Now the question is..   without applying the watermarks to the original image.. is it possible to apply the watermark to the resized images ? 
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 06, 2011, 09:57:35 PM
Hi,
     Yes, you are correct. This mod applies the water mark to the original image.   

Now the question is..   without applying the watermarks to the original image.. is it possible to apply the watermark to the resized images ? 

I noticed that the watermark mod does not modify the file in the big folder...
So my smaller display image in the normal folder has the watermark on it but the original bigger file does not...

in your download.php file...
Look for my code insert in this file that looks like this...
Code: [Select]
$file['file_path'] = $multi_new_image;


insert After
Code: [Select]
//-------------------------------------------------------------------------------------------
// --- Annotate Resized Images ----------------------------------------------------------------------
//-------------------------------------------------------------------------------------------
if ($config['annotation_use'] && strtolower($file_extension == jpg)) {
require(ROOT_PATH.'includes/annotate.php');
$ann_user_name = ($user_info['user_name']);
annotate_image($file['file_path']);
}
//-------------------------------------------------------------------------------------------

The only thing that I saw that may be a problem is that the watermark shows very small on the large images
And also, once it creates the re-sized image with the watermark, it will always be there for that re-sized image unless you delete them
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: batu544 on March 07, 2011, 07:29:19 AM
Thanks budduke... I will test this code within 2-3 days and let you know the result..



Thank you
batu544
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: aliosa on March 21, 2011, 08:54:49 PM
Hi

I just installed your mod on 1.7.9 , and i get the following error when i upload an image


Warning: array_walk() [function.array-walk]: Unable to call trim_value() - function does not exist in /home/zoomphon/public_html/member.php on line 507

Warning: array_walk() [function.array-walk]: Unable to call trim_value() - function does not exist in /home/zoomphon/public_html/includes/search_utils.php on line 98

Could you please help me out..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 22, 2011, 12:14:48 AM
Hi

I just installed your mod on 1.7.9 , and i get the following error when i upload an image


Warning: array_walk() [function.array-walk]: Unable to call trim_value() - function does not exist in /home/zoomphon/public_html/member.php on line 507

Warning: array_walk() [function.array-walk]: Unable to call trim_value() - function does not exist in /home/zoomphon/public_html/includes/search_utils.php on line 98

Could you please help me out..

Are you sure you posted in the correct mod? This mod does nothing with uploading an image. It only modifies a file when you are downloading it from the site and not uploading...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: aliosa on March 22, 2011, 06:42:17 AM
Hi

Thanks for the reply, i checked every file again, the problem was with functions.php.  Now i get no errors but still no multi download appears on the image page.
I'm clueless ..
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 22, 2011, 11:19:19 AM
Hi

Thanks for the reply, i checked every file again, the problem was with functions.php.  Now i get no errors but still no multi download appears on the image page.
I'm clueless ..

Can you zip all the files you changed and attach them so I can take a look at them?
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: aliosa on March 22, 2011, 12:01:44 PM
Thank you so much, if you manage to solve this you get a premium link on my brand new website. :D
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 23, 2011, 12:04:50 AM
Now i get no errors but still no multi download appears on the image page.

Your files look the same as mine...

I should have looked at your post a little closer,
In the admin control panel,
Under the category you want to use for the multi-download, choose edit.
Is the multi-download option turned on?
 :wink:
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: aliosa on March 23, 2011, 05:54:32 AM
 8O AAAAAA NO!!

That was it, thanks a lot. So do you want a link on my website ? if so please pm me your details.
Could i change the script in order to resize the images by their height rather than their width?


btw: the website is zoomphones.net
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on March 23, 2011, 07:19:40 PM
If you only adjusted the height without resizing the width, it would squash the image...
look at the variables in the global.php file...
The crop may do what you want, after it resizes the image it then cuts some of it off to get it to that actual size you want but you will loose some of the image. I think this is better then squishing the image.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wallpapers on April 11, 2011, 09:33:08 PM
Hello everybody.
I have installed and it's working good. (Yes except for one tiny thing)  :oops:

I have wallpapers on my page and the smallest is about 1680x1050.
But as you can see in the picture below these are the only options i have to choose from.
(http://www.friendsinwar.com/resolution_problem.jpg)

I know the script is looking for the image showed in the detail.php page and i'm using the "big mod".
So i think the script is looking in the wrong map, He is not looking in the "/big" map.
I tryd many things to solve it but no luck. I hope someone have a solution.

I hope i explain myself good.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on April 12, 2011, 12:19:36 AM
@wallpapers,
This mod does work with the bog mod

I have found the easiest thing is for me to check your files that you inserted the code into.
If you can zip all the changed files and I can compare them with mine to see where something is inserted incorrectly.

If you have a link where I can see what is happening, that usually can lead me down the right road also...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wallpapers on April 12, 2011, 05:47:24 AM
@budduke 

Thanks for your fast reply.

Some more info for you:
I use version 1.7.9
You can find the site at http://www.friendsinwar.com
There is a test catagory for you at: http://www.friendsinwar.com/categories.php?cat_id=29
I changed the dot to "Yes, Only allow smaller sizes then original to be selectable" (The rest of the site is "Yes, Allow all sizes to be selectable").
You can download the .zip with the changed files at: http://www.friendsinwar.com/MOD_-_Multisize_download_-_Changed files.zip

I hope didn't forget to mention.
Thanks for you your time.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on April 13, 2011, 02:09:16 AM
@ wallpapers,
Not sure which big folder mod you were using. I went in and cleaned up as much as I could. Hopefully there wasn't any leftover code...
The Big folder mod I am using and most people with 1.7.9 is
http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451 (http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451)
I placed it's code in the attached files, make sure you backup your original files before placing these in their place in case something is still lurking from the big code that you put in. You may want to remove anything I may have forgot and then make sure you just have the above linked code instead in your files then everything should work correctly for you...
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: wallpapers on April 13, 2011, 05:45:45 AM
@budduke

I have checked your files and it's working perfectly.
It's amazing.
Thank you very much for doing this. :D

I don't know for sure witch "big mod" it was.
I trys so many things and changed so many thing by my own. (but i think you saw it in the crappy code  :roll:)

But anyway it's working fine now and once again thanks.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: kar76 on June 12, 2011, 05:57:16 PM
Hello Friends  :)

I am not expert but i can follow instructions. So i want to know that, Is these links generated by this mode indexed by Google if not then no problem. But if Google indexed these links then Please someone guide me how to place meta data in these links. As i can see
there is only image files shown and i am not able to figure it out how to do this.

Thanks
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on June 12, 2011, 06:57:44 PM
Hello Friends  :)

I am not expert but i can follow instructions. So i want to know that, Is these links generated by this mode indexed by Google if not then no problem. But if Google indexed these links then Please someone guide me how to place meta data in these links. As i can see
there is only image files shown and i am not able to figure it out how to do this.

Thanks

I am assuming you are talking about opening the images in a new window...
Google would only index your details pages and not the resized images because you have to hit the submit button to get to them (at least I think that is correct)
I thought about using a template for the popup window but never went down that road as of yet, if more people are asking for it I may look into it.

UPDATED: I looked a little further into it, if you are using the text/image links then there is no submit button and I am assuming that Google would try to follow those links which would just be the popup with the image in it. If I get some extra time I will see if I can come up with a template you could use for the popup unless someone that know google better then me knows that they do not follow popups
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: kar76 on June 12, 2011, 10:56:41 PM
Thanks for Reply

You are right i am talking about text links. I am not seo expert. I ask because i use this with "Google Friendly Urls For 4images Best Seo Mod" and what link i see is also goggle friendly. I thought it will be good if we put meta tags there. And as for popup window if you see
with right click page source file, You will see with Google friendly mode in any category all thumbnail images open with popup windows.
And i saw some site having these types of links get indexed.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: kar76 on June 16, 2011, 03:03:10 PM
Hello Budduke  :)

Besides template i have another problem to solve. This problem related with your mode work with "Google Friendly Urls For 4images Best Seo Mod".

With Google Friendly Urls Mode when i change in detail page dropdown box to text links it show link like this (/download.php?action=resize&;image_id=64&;multi_download_select=1)

But when i turn this to Image option it work fine and show link (/download-art-design-002-26-1-800x600.htm).

I want text option instead of image option. Please help.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on June 17, 2011, 12:38:32 AM
@kar76,
Can you post or send me your sessions.php and .htaccess files for me to look at?

I looked over my code and everything looks correct.
When I use the dropdown list I get (/download.php) in my address bar.
the text/image links give the full (/download.php?action=resize&;image_id=64&;multi_download_select=1)
I am not seeing the download-image-size.htm link.

PS:
I got the template ready for your other request, but I will wait to post update to this mod till I make sure I do not have to modify anything else in the code for this problem
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: kar76 on June 17, 2011, 01:51:55 AM
Hello budduke

I have uploaded whole Mobile Server Setup which i am using to customize code and template. You can download it from this link ( http://www.mediafire.com/?7xssjb9i5s2z8sq ) use this setup to understand what i want. As i mention in fist reply i am not using this model alone. I am using this mode with "Google Friendly Urls For 4images Best Seo Mod". The links should be "download-image-size.htm".

If you use image links it is (/download-image-size.htm) this is correct but if you change to text links it is (/download.php?action=resize&;image_id=64&;multi_download_select=1) this is wrong


And

One more problem i am facing its related to Autoresize image. This problem you can find in attached setup too.
As with your mode when someone upload image it show images smaller and equal than upload size but if i resize image it started to show size smaller than resized image. It must show size smaller than orignal uploaded size not resized size. You can see in setup what i mean.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on June 18, 2011, 12:43:11 AM
@kar76,
It looks like whatever tool you used for editing your functions.php file added some semi-colons where they should not have been. I re-checked my code posted and it is correct.
attached is your repaired functions.php file.

the other resize problem is normal for a default install, if you are wanting to keep the original "big" size file after resizing it in the admin area you need to install the mods in this tutorial.
http://www.4homepages.de/forum/index.php?topic=20496.0 (http://www.4homepages.de/forum/index.php?topic=20496.0)

PS: anyone who sends me Avril Lavigne to look at is alright in my book  :)
I would love to see your site when finished, if you could PM me a link. I collect celeb pics for awhile now...

I should have your other request (popup template) posted this weekend. We have some strongs storms coming through, so will have to wait and see how the weekend goes.
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: Nosferatu on June 18, 2011, 06:03:22 PM
hi
this mod work perfect with 1.7.10   8)
http://www.pj-firepower.com/picgallerie/details.php?image_id=5969

but i have a questions for what is the "big" folder ?
have i do create this folder ? or create the program this automatic ?
can i give pics on it ???

can i set autmatic the system on ? or have i do it with all categories ....

best regards
jeff
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on June 18, 2011, 08:52:31 PM
hi
this mod work perfect with 1.7.10   8)
http://www.pj-firepower.com/picgallerie/details.php?image_id=5969

but i have a questions for what is the "big" folder ?
have i do create this folder ? or create the program this automatic ?
can i give pics on it ???

can i set autmatic the system on ? or have i do it with all categories ....

best regards
jeff

My mod creates the big folder (if not already there) as needed...
But if you want to use the big mod folder you will need to install the mods in the tutorial...
http://www.4homepages.de/forum/index.php?topic=20496.0 (http://www.4homepages.de/forum/index.php?topic=20496.0)
The overview of the big folder is that when you resize your images to place them on your detail pages in a smaller fashion, the big mod stores the original files (the big sized ones) in the big folder and when you users download them after installing the mods in the tutorial they will download the original (big) files instead of the resized ones that are displayed on your detail pages


ALSO,
Just posted the update to version 4.4
I fixed an error I was seeing on my site (division by zero warning)
Added Template to the popup window that was requested.
The only downlside I see to allowing google to index the popup window is that if someone clicks on the google link going directly to the popup window that was indexed then the user will see a message "hotlinking not allowed", which is the way 4images stops people from linking directly to the images on your site. I did see somewhere, you can turn this off, but I feel it would be better not to index the popups. (my 2 cents)
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: kar76 on June 18, 2011, 09:44:25 PM
 Hello budduke

I have problem related to Dimensions.

I have uploaded image of Dimension 1920x1200 and re-sized it to 580x362 . Original file save in Big folder. But on detail page it show Dimensions Smaller than 580x362. There is no dimensions like 1600x1200 or 1024x768 etc.

But when i click on Orignal Size link it show orignal image in open window. But url show -580x362.htm
I attach screen-shot
Title: Re: [MOD] Multi Size Download of same image [ver 4.3]
Post by: budduke on June 18, 2011, 10:36:51 PM
Hello budduke

I have problem related to Dimensions.

I have uploaded image of Dimension 1920x1200 and re-sized it to 580x362 . Original file save in Big folder. But on detail page it show Dimensions Smaller than 580x362. There is no dimensions like 1600x1200 or 1024x768 etc.

But when i click on Orignal Size link it show orignal image in open window. But url show -580x362.htm
I attach screen-shot

If you change the categorie back to the default 4images download button, which image does it download? the 1920X1200 or the 580X362?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: kar76 on June 18, 2011, 11:44:50 PM
On default Download Button it download 580X362 dimension which i resized.

With your mode on clicking Original Size it show 1920x1200, Which saved in big folder.

It link the real image from big folder but can not identify dimension.

Dimension identify from category (main) folder.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on June 18, 2011, 11:50:10 PM
On default Download Button it download 580X362 dimension which i resized.

With your mode on clicking Original Size it show 1920x1200, Which saved in big folder.

It link the real image from big folder but can not identify dimension.

Dimension identify from category (main) folder.
Yes, recheck the code you placed when you entered the turorial mod,
mainly this one...
http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712 (http://www.4homepages.de/forum/index.php?topic=7499.msg33712#msg33712)
Look over the download.php file insert, I think that is where your problem is...
No, looking over that mod again, I think it detect the other directoy in the functions.php file instead
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Nosferatu on June 19, 2011, 02:37:49 AM
OK Thank you!

On your gallery you have 7 pics above the picture, which mod do you use or how do it works that ?

thanks !

regards
jeff
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on June 19, 2011, 01:28:07 PM
OK Thank you!

On your gallery you have 7 pics above the picture, which mod do you use or how do it works that ?

thanks !

regards
jeff

The one that I used is no longer available but this one looks like an updated version of it...
http://www.4homepages.de/forum/index.php?topic=7294.msg150916#msg150916 (http://www.4homepages.de/forum/index.php?topic=7294.msg150916#msg150916)
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: kar76 on June 19, 2011, 06:12:39 PM
Hello budduke

// Download file block insert BEGIN
    switch( $image_type ) {
     case "media":
       if( $cat_id )
         $path = MEDIA_PATH."/".$cat_id;
      else
        $path = MEDIA_TEMP_PATH;
       break;
      case "big":
        $path = MEDIA_PATH."/".$cat_id."/big";
       break;
      case "download":
        $path = MEDIA_PATH."/".$cat_id."/download";
       break;
     default:
       if( $cat_id )
         $path = THUMB_PATH."/".$cat_id;
      else
        $path = THUMB_TEMP_PATH;
       break;
   }
   $path .= "/".$file_name;
// Download file block insert END


Problem is in this red line of this code. It pick image info from (/1) main folder but if i change it as $path = MEDIA_PATH."/".$cat_id."/big"; then it pick image from big folder (/1/big).

Isn't there anyway to separate image preview from image download block created by your mode.

I think if we separate both of them then we can pick image preview from main folder (then there will be no problem about size) and download image block from big folder.

I am not coder so i can not create it by my self.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on June 19, 2011, 07:59:27 PM
The code is correct, you have something copied/placed incorrectly. If you are not getting the big file with the normal 4images download button then something is not inserted correctly.
if you look at the code you posted deeper (5 lines below the red one)
It looks for the "big" image in the case "big", if it does not detect it because of code above it, it pulls the image from the default "media" folder.
Did you install the links I posted above? They will give you the Big files that your database will look for if correctly configured (this is outside my mod)
Until you get the normal 4images download button to give you the big file, there is no way my mod will fix that error because it is outside the mod.
On default Download Button it download 580X362 dimension which i resized.
You default download button (not my mod) should not give you the resized 580X362 image. It should download the larger 1920X1200 image. When you fix that error somewhere then my mod will also be fixed because it can not look in the big folder if the normal 4images code does not see the folder.
Is this site the same one that you set me as a mobile 4images? I may have time to look through to see if I see anything.

UPDATE: I went through your files and found that if you use the updated info for the alternate directory (I was using the original) it completely messes up my code.
I installed a quick fix into your files, see how they do for you.

Any one following this thread and using the update code found here...
http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451 (http://www.4homepages.de/forum/index.php?topic=7499.msg148451#msg148451)
You will need to add this quick fix to get my code to work correctly till I think this through better.
at the top of my code that is inserted that begins with
Code: [Select]
// MOD multi download
$sql = "SELECT multi_download
        FROM ".CATEGORIES_TABLE."
        WHERE cat_id = ".$image_row['cat_id']." ";
$result = $site_db->query_firstrow($sql);
you need to place this code Before it.
Code: [Select]
      $big_file = MEDIA_PATH.(($image_row['cat_id'] != 0) ? "/".$image_row['cat_id'] : "")."/"."big"."/".$image_row['image_media_file'];
      $download_file = MEDIA_PATH.(($image_row['cat_id'] != 0) ? "/".$image_row['cat_id'] : "")."/"."download"."/".$image_row['image_media_file'];
       if (file_exists($big_file)){
        $bild = $big_file;
      }
       if (file_exists($download_file)){
        $bild = $download_file;
      }
      $src_download = (!file_exists($bild) && file_exists(preg_replace("/\/{2,}/", "/", get_document_root()."/".$bild))) ? preg_replace("/\/{2,}/", "/", get_document_root()."/".$bild) : $bild;
      if ($temp = @getimagesize($src_download, $bild)) {
        $download_width_height = " ".$temp[3];
        $download_width = (isset($temp[0]))? $temp[0]:"";
        $download_height = $temp[1];
      }
  $site_template->register_vars(array(
"download_width" => $download_width,
"download_height" => $download_height
));

A little sloppy work till I can look at things closer to see why they moved the width/ height info further down the code (after mine that needs it)
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Nosferatu on June 20, 2011, 03:35:04 PM
OK Thank you!

On your gallery you have 7 pics above the picture, which mod do you use or how do it works that ?

thanks !

regards
jeff

The one that I used is no longer available but this one looks like an updated version of it...
http://www.4homepages.de/forum/index.php?topic=7294.msg150916#msg150916 (http://www.4homepages.de/forum/index.php?topic=7294.msg150916#msg150916)

THANK YOU !!
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: kar76 on June 21, 2011, 03:30:20 PM
Hello budduke  :D

This is Excellent Work. You get 10/10. This is what i want. Thanks for Everything.

And one more thing this fix show all dimensions from all sizes. If you have time see if you can change it to identify only size uploaded

image only. It will reduce web-space and  some non required dimensions. PM when you fix it.

Thanks
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: raghunadhreddys on July 29, 2011, 08:38:27 PM
After modifying the files,my site has goneeeeeeeeeeee.nothing found.waste moddddddddddd
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on July 30, 2011, 12:25:54 AM
After modifying the files,my site has goneeeeeeeeeeee.nothing found.waste moddddddddddd

Are you sure that you followed the steps correctly? There are quite a few people using this mod without any issues...
If you zip and send me your modified files I will take a look to see what might be wrong...
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: pkwebhost on August 21, 2011, 01:47:26 PM
hi
i have setup all but it giving error

DB Error: Bad SQL Query: SELECT multi_download FROM 4images_categories WHERE cat_id = 3
Unknown column 'multi_download' in 'field list'

DB Error: Bad SQL Query: SELECT multi_download FROM 4images_categories WHERE cat_id = 3
Unknown column 'multi_download' in 'field list'

DB Error: Bad SQL Query: SELECT multi_download FROM 4images_categories WHERE cat_id = 3
Unknown column 'multi_download' in 'field list'
for live link
xxx: megafdxxx: /details. php?image_id=1
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on August 21, 2011, 07:58:03 PM
@pkwebhost,
Did you run the install file that should have placed the multi_download column into your datqabase?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: ajaykumar9887 on September 13, 2011, 04:28:12 PM
its not working for me(i try fresh install on 4image 1.7.9......it show no error.....but multiple download option is not available..............

you can check my follwing url

xxx: xxx: studyparadisexxx: /wallpapers/img-beautiful-tropical-nature-dsc04685-6411. htm

if you can check i send my login details


reply me--------------i am waiting for it
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on September 13, 2011, 07:04:57 PM
its not working for me(i try fresh install on 4image 1.7.9......it show no error.....but multiple download option is not available..............

you can check my follwing url

xxx: xxx: studyparadisexxx: /wallpapers/img-beautiful-tropical-nature-dsc04685-6411. htm

if you can check i send my login details


reply me--------------i am waiting for it

When you go to your admin panel, under edit categories, and edit the category that you want to use for multi-download. Is the option listed there to select?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: ajaykumar9887 on September 20, 2011, 02:20:07 PM
i got following error.....

Code: [Select]
Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home//public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

Warning: Division by zero in /home/studyajr/public_html/wallpapers/includes/functions.php on line 632

please suggest me solution
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on September 21, 2011, 12:51:43 AM
@ ajaykumar9887,

I have not seen that message for a few versions. I just tested my test site and do not see the division by zero.
If you are getting it then there may still be a bug floating around this mod I will need to work on..
the easy fix if to turn off the warning messages in php for now. the code will still function till I have time to look at it.
If you send me a zip file of your changed files I can look them over to see if anything is out of place.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: V@no on September 21, 2011, 01:59:23 AM
the easy fix if to turn off the warning messages in php for now.
Or replace
 if (((($max_width/$max_height)==($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2]))&&($multi_download_var['ratio']))||(!$multi_download_var['ratio'])){

With this:
 if (!$multi_download_var['ratio'] || (@($max_width/$max_height)==@($download_multi_sizes[$var][1]/$download_multi_sizes[$var][2])&&$multi_download_var['ratio'])){


Note the "@" signs, these will suppress any warnings.

P.S.
you don't have to include everything into parentheses and also when there is an "OR" condition it's better put first the most simple condition, could possible save 0.00001% on performance :D
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: ajaykumar9887 on September 21, 2011, 03:34:37 PM
@pkwebhost,
Did you run the install file that should have placed the multi_download column into your datqabase?
i install that correctly.....can you fix it on my website
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on September 21, 2011, 11:33:07 PM
@pkwebhost,
Did you run the install file that should have placed the multi_download column into your datqabase?
i install that correctly.....can you fix it on my website
Not sure what your question is? Is the Mutli_download field in your category database?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: tspitaler on December 23, 2011, 04:51:20 PM
Hi there,
first of all - a great mod and love how it works.
i installed it on a brandnew 1.7.10 with the documentation that is shown.
Everything works pretty fine - except one thing - i cannot add any more categories in the administration.
renaming and changing from resizable to no resizable works pretty well too.
Someone knows about this problem and can help ?

thanks and have a great xmas
tom
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: V@no on December 23, 2011, 05:09:15 PM
Welcome to 4images forum.

Do you get any error messages?

Please attach your admin/categories.php
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: tspitaler on December 24, 2011, 01:52:44 PM
Hi V@no,
and thanks for the fast reply - and have a great xmas.

the only error i got is "Error adding category" after submit the new category. i included the admin/categories.php and the error message (printscreen).
I checked the file categories.php but didnt find an error.

thanks again for your help
tom
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: V@no on December 24, 2011, 05:35:57 PM
You've missed one line in step 2. (there are two places needed changes) To save you time it's line 515.

P.S.
Kudos to you for finding proper lines even though they are different then per instructions. Good job.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: tspitaler on December 25, 2011, 01:14:00 AM
hi v@no - u have one xmas present good ;)
thanks for finding my mistake - im not sure what happened here - got the input on both places on my file local - but not on the file on the server. and i sent u the server file.

thanks again and have gr8 xmas
tom
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: sathishIPL on December 26, 2011, 06:42:19 AM
Hi ,

I have a simple clarification here.

The re size of an image will be created on the fly.

Is the re sized image will be remain  in the big folder? and it wont be deleted after the download.

Thank You...!

Br,
satz

Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on December 26, 2011, 07:15:52 PM
Hi ,

I have a simple clarification here.

The re size of an image will be created on the fly.

Is the re sized image will be remain  in the big folder? and it wont be deleted after the download.

Thank You...!

Br,
satz



You are correct, After the image is resized, it is stored in the big folder and does NOT delete after the user downloads it so your server will not have to make the image everytime someone requests it. If the mod sees it has already been created once, it just uses that image instead of recreating it.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: survivedavis on February 27, 2012, 02:32:20 AM
Hello,

I recently added this mod to a fresh install of version 1.7.10 along with the [Mod] Same Image in multiple Categories (http://www.4homepages.de/forum/index.php?topic=27570.0).

Everything for both mods seems to be working correctly, except that the images produced are very blurry, even if I click on "original size." This appears to be the same issue lona_jasty had in page 1 of this thread, however that was several versions ago and I'm having difficulty determining where something may have gone wrong. Any ideas on what I've done wrong? Thanks!
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on February 27, 2012, 11:59:26 PM
Hello,

I recently added this mod to a fresh install of version 1.7.10 along with the [Mod] Same Image in multiple Categories (http://www.4homepages.de/forum/index.php?topic=27570.0).

Everything for both mods seems to be working correctly, except that the images produced are very blurry, even if I click on "original size." This appears to be the same issue lona_jasty had in page 1 of this thread, however that was several versions ago and I'm having difficulty determining where something may have gone wrong. Any ideas on what I've done wrong? Thanks!

It usually happens when something is placed in the wrong spot. It sound like it is trying to resize your thumbnail image instead of the actual image.
Can you zip all the changed files and provide me with a link to compair them with my copies?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: survivedavis on February 28, 2012, 04:47:37 AM
Here are my files. Thank you for taking the time to look over these!
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on February 29, 2012, 12:14:25 AM
Here are my files. Thank you for taking the time to look over these!

I think the big problem is in the function file. (fixed one attached)
I think I fixed everything in it to where it should work.
Let me know if you are still having problems, I saw a couple of things in the download file but do not think it should cause this problem.

PS: welcome to the forum! I see you are new...
I installed my first 4images gallery a few years back and have been hooked ever since.
The people and support on the board is the best I have found.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: survivedavis on February 29, 2012, 07:57:32 AM
Thank you! I tried the new functions file and it works perfectly.

I gave a quick test run of 4images, gallery, and coppermine and very quickly fell in love with 4images. And the powerful mods such as yours make it perfect for any application I can currently think of. Thank you so much for the mod and the support!
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: wallward on May 03, 2012, 09:17:52 PM
Hi,
very wonderful
I try to this change but after  modify files my site not work
please uploade modify file for 1.7.10, please  :oops:
sorry 4 my bad english  :roll:
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on May 03, 2012, 11:15:38 PM
Hi,
very wonderful
I try to this change but after  modify files my site not work
please uploade modify file for 1.7.10, please  :oops:
sorry 4 my bad english  :roll:


Welcome to the forums!

Depending on the mods you already have installed on your site, everyones files are a little different.
If you attach your changed files with the mod added to them, I will look them over and see if I see where you might have gone wrong.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: wallward on May 04, 2012, 12:14:59 AM
many thanks budduke :)
Please check Attach file
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on May 04, 2012, 01:17:50 AM
many thanks budduke :)
Please check Attach file

I saw a couple of mistakes in two of the files. The modifield files are attached...
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: wallward on May 04, 2012, 01:24:56 AM
thank you Man,
if it possible please see my details.html
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on May 04, 2012, 11:45:18 AM
thank you Man,
if it possible please see my details.html

That file looks correct.
You do have to turn on the multi download option in the admin settings.
Look under the settings for your category, you will see where to turn it on/off
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: wallward on May 04, 2012, 11:53:09 AM
I know you are busy, And this request is not properly, but if possible please check my setting and see my site
http://wallward.net

i send admin password with pm to you
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: wallward on May 19, 2012, 03:20:25 PM
Hello again budduke
and many thank you for previous answer  :mrgreen:
I have another question,
when add new image to gallery, I resized image and save original image in big folder,
how to config this MOD to use original image from big folder when user request image with download button?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on May 19, 2012, 05:35:26 PM
Hello again budduke
and many thank you for previous answer  :mrgreen:
I have another question,
when add new image to gallery, I resized image and save original image in big folder,
how to config this MOD to use original image from big folder when user request image with download button?

It should do that automatically for you as long as it and the big mod was installed correctly.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: aliosa on May 28, 2012, 12:41:48 PM
Hi

Now my images open in a new window, how do i set the path in order to jump directly to download ( by download i mean the option to select the download place)
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on May 28, 2012, 02:37:40 PM
Hi

Now my images open in a new window, how do i set the path in order to jump directly to download ( by download i mean the option to select the download place)

Does the normal download button (without using this mod) also open in new window or does it ask where to download?
If it also opens in a new window then it is in the browser doing it.
If it asks for a download location, then look at the variable in this mod in the global.php file
$multi_download_var['target']="";
If that is set for "" then it should ask for the download location, if you have it set for "_blank", it will open in a new window.

If that is not how it is working then something is not placed correctly in one of your files. If you can zip your changed files and give me a link to it, I will take a look.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Tiburon on September 14, 2012, 10:52:10 AM
First of all, thanks for developing this mod, really good work.

I tested it with the actual version 1.7.11 and there seems to be a problem with adding new categories.

Normally you have to search the following cod twice, when modifiying the admin/categories.php
$auth_postcomment = $HTTP_POST_VARS['auth_postcomment'];

This code has changed in version 1.7.11 to:

 $auth_postcomment = intval($HTTP_POST_VARS['auth_postcomment']);

// MOD Multi Download
  $multi_download = (isset($HTTP_POST_VARS['multi_download'])) ? intval($HTTP_POST_VARS['multi_download']) : 0;
// END MOD Multi download

I inserted the Mod code above after those new versions (twice), but that doesnīt work. It is no longer possible to add a category.
Donīt know how, but it might be, that the Mod code at this point has to be changed a little bit.
When I replaced the new "admin/categories.php" with an older modified version, it worked again.



Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on September 14, 2012, 04:21:06 PM
@Tiburon,
I have not installed this mod on 1.7.11 but looking it over it should still work. I may have time this weekend.
Can you PM me your admin/categories.php file with the mod placed so I can compare it with my copy?

Will let you know what I find,

UPDATE:
There was a missing closing bracket in the file that took care of the issue...
What Tiburon pointed out is correct, if you are using this on 1.7.11 look for the newer search item instead of the original
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Tiburon on September 17, 2012, 05:49:55 PM
Hi Budduke,

thank you for fixing this problem now. Creation and deleting of categories works fine now but it seems that there is another problem with the new version of 4images.

I tried to install the mod twice with a new installation of 4images 1.7.11 and everything seems to work but when I want to download an image it opens in a new window (like i want it to do) but then I get an broken image.
Donīt know if this might be caused by download.php or if I made a mistake.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on September 18, 2012, 06:44:46 PM
Hi Budduke,

thank you for fixing this problem now. Creation and deleting of categories works fine now but it seems that there is another problem with the new version of 4images.

I tried to install the mod twice with a new installation of 4images 1.7.11 and everything seems to work but when I want to download an image it opens in a new window (like i want it to do) but then I get an broken image.
Donīt know if this might be caused by download.php or if I made a mistake.


I took a look at @tiburon's download.php file and saw the mistake. It is working now.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Tiburon on September 25, 2012, 05:26:36 PM
Thank you for looking after it. Everything works perfectly now  :D
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Solanum on November 06, 2012, 05:56:10 AM
Hi all,

I've installed this MOD on 4images 1.7.11 with installed multi language MOD for any text ( http://www.4homepages.de/forum/index.php?topic=6749.0 ).
In the admin categorie settings the line to switch on the multi size function is empty but I switched it on in the database by setting the value "2".
If I want to download a picture a "http 500 error" page appears.

The error log says:

Code: [Select]
PHP Parse error: syntax error, unexpected '}' in /var/www/vhosts/mydomain.com/httpdocs/swfpics/download.php on line 315, referer: http://mydomain.com/swfpics/details.php?image_id=69&sessionid=2reqr03focvtarqukmihc80pg2
Does anyone have an idea whats wrong? As far as I understand the bracket is correct and I checked all my inserts to download.php
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on November 06, 2012, 10:40:51 PM
Hi all,

I've installed this MOD on 4images 1.7.11 with installed multi language MOD for any text ( http://www.4homepages.de/forum/index.php?topic=6749.0 ).
In the admin categorie settings the line to switch on the multi size function is empty but I switched it on in the database by setting the value "2".
If I want to download a picture a "http 500 error" page appears.

The error log says:

Code: [Select]
PHP Parse error: syntax error, unexpected '}' in /var/www/vhosts/mydomain.com/httpdocs/swfpics/download.php on line 315, referer: http://mydomain.com/swfpics/details.php?image_id=69&sessionid=2reqr03focvtarqukmihc80pg2
Does anyone have an idea whats wrong? As far as I understand the bracket is correct and I checked all my inserts to download.php

I sounds like something is not placed correctly somewhere, Can you zip all your changed files and post them and I may have time to compair them with mine to see what may be wrong?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Solanum on November 06, 2012, 11:02:31 PM
Hi budduke,

thank you for the quick reply. Attached are my files. I have to say I already solved the problem with the empty line in the backend ( :oops: stupid mistake) but the download still doesn't want to work.
I tried it with and without the pop up function but this didn't change anything.

Would be great if you can solve the problem.

Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on November 07, 2012, 06:56:42 PM
Hi budduke,

thank you for the quick reply. Attached are my files. I have to say I already solved the problem with the empty line in the backend ( :oops: stupid mistake) but the download still doesn't want to work.
I tried it with and without the pop up function but this didn't change anything.

Would be great if you can solve the problem.



I only looked over the download.php file since that seemed to be the one you was having issues with. Attached is the fixed one.
Apperently, there are two places that the code can be placed, anyone reading this when you are looking for...
Code: [Select]
if ($user_info['user_level'] != ADMIN) Looks for the second one in the download.php file...
I will have to update my instructions when I get time...
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Solanum on November 08, 2012, 09:35:39 PM
Thanks, it now opens a download but the image has 0kb size and the "big" folder is empty. Chmod is 777 on the folder.

Any idea what can be wrong now?
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on November 08, 2012, 09:56:08 PM
Thanks, it now opens a download but the image has 0kb size and the "big" folder is empty. Chmod is 777 on the folder.

Any idea what can be wrong now?

I looked over your functions.php file and there were a few missing brackets (not in my mod area but in the big mod area)
try this one and let me know...
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Solanum on November 09, 2012, 09:45:37 AM
I replaced it and cleared the chache, still the same problem.

The error log says:

Code: [Select]
PHP Warning: filesize(): stat failed for /var/www/vhosts/mydomain.com/httpdocs/./data/media/6/big/dsc_3823__resized_128x128.jpg in /var/www/vhosts/mydomain.com/httpdocs/swfpics/download.php on line 85, referer: http://mydomain.com/swfpics/details.php?image_id=52
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on November 09, 2012, 01:40:09 PM
I replaced it and cleared the chache, still the same problem.

The error log says:

Code: [Select]
PHP Warning: filesize(): stat failed for /var/www/vhosts/mydomain.com/httpdocs/./data/media/6/big/dsc_3823__resized_128x128.jpg in /var/www/vhosts/mydomain.com/httpdocs/swfpics/download.php on line 85, referer: http://mydomain.com/swfpics/details.php?image_id=52


Can you PM me your website so I can see it in action...
I may also need admin access but will let you know.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Tiburon on November 14, 2012, 09:56:28 AM
Hi Budduke,

I fear that I found another little problem with the actual version of 4images.

What happens to me is that I canīt restrict the resizes to images that are smaller than the original one that lies in the root of the category folder.
So it happens, that I have an image with a resolution of e.g. 1600x1200px but on detail page I can resize also the bigger resolutions (e.g. 2560x1920) although I configured the category in that way, that only smaller sizes than the original should be offered.

I first thought that that might be caused by other mods I use, but now I tried it with a clean installation of 4 images and the same thing happens. The strange thing is, that it seems to work perfectly the first time the image is selected. So if a new image is selected the first time everything works correctly, if I reload the page, all resolutions that I have in my global.php are shown, without restricting the bigger sizes that I do not want.

Any idea what might be the problem?

Thank you

Tiburon
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: budduke on November 14, 2012, 08:06:40 PM
Hi Budduke,

I fear that I found another little problem with the actual version of 4images.

What happens to me is that I canīt restrict the resizes to images that are smaller than the original one that lies in the root of the category folder.
So it happens, that I have an image with a resolution of e.g. 1600x1200px but on detail page I can resize also the bigger resolutions (e.g. 2560x1920) although I configured the category in that way, that only smaller sizes than the original should be offered.

I first thought that that might be caused by other mods I use, but now I tried it with a clean installation of 4 images and the same thing happens. The strange thing is, that it seems to work perfectly the first time the image is selected. So if a new image is selected the first time everything works correctly, if I reload the page, all resolutions that I have in my global.php are shown, without restricting the bigger sizes that I do not want.

Any idea what might be the problem?

Thank you

Tiburon

The thing that is troubling me in your post is that you are saying when it first brings the details page up everything is correct?
Then if you hit refresh it gives you all the options? Are you caching those pages? Can you turn it off to see if it is a caching issue because it should do the same thing each time.
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Tiburon on November 15, 2012, 07:33:06 AM
The thing that is troubling me in your post is that you are saying when it first brings the details page up everything is correct?
Then if you hit refresh it gives you all the options? Are you caching those pages? Can you turn it off to see if it is a caching issue because it should do the same thing each time.

Yes, a cache issue was my first thought, but caching is disabled, browser cache is empty, delete cache plugin used and cache folder manually checked and empty. I thought that I solved the problem when this happened first with the new installaion, but after a refresh of the image, all resoultions were shown again.  

Update: Now I took again a complete new installation, with a new database, and it seems to work. So, please do nothing :)

Next Update:: I have no idea what it is. I thought it was the database, but now I get the same problem again, after doing the whole work again. After some testing I found out, that it is really luck what appears on the details page. With each Browser Refresh I get another result. Sometimes it is 2 or 3 times correct, sometimes its 2 or 3 times wrong and all sizes are shown. Seems that the Mod has problems to identify the correct size of the image from which he should resize the downloads. Itīs changing all the time. Really strange.

 
Title: Re: [MOD] Multi Size Download of same image [ver 4.4]
Post by: Solanum on November 24, 2012, 05:30:05 AM
I replaced it and cleared the chache, still the same problem.

The error log says:

Code: [Select]
PHP Warning: filesize(): stat failed for /var/www/vhosts/mydomain.com/httpdocs/./data/media/6/big/dsc_3823__resized_128x128.jpg in /var/www/vhosts/mydomain.com/httpdocs/swfpics/download.php on line 85, referer: http://mydomain.com/swfpics/details.php?image_id=52


Can you PM me your website so I can see it in action...
I may also need admin access but will let you know.

Sorry for the delay.  :oops: You should have a message in your inbox.
Title: Re: [MOD] Multi Size Download of same image [ver 4.5]
Post by: budduke on January 13, 2013, 07:48:52 PM
This mod has been updated to version 4.5

There was a major flaw where it was getting the file dimensions from the random image instead of the detail image...
Please note in the new instructions...
The code in the Functions.php now has to go after the "rate_form"
In the old instructions it was placed in before it. Please remove the code from Before the "rate_form" and follow the instructions as to where to place the modified code After that area of the functions file and you should be good.
Title: Re: [MOD] Multi Size Download of same image [ver 4.5]
Post by: Tiburon on January 14, 2013, 08:51:11 AM
This mod has been updated to version 4.5

There was a major flaw where it was getting the file dimensions from the random image instead of the detail image...
Please note in the new instructions...
The code in the Functions.php now has to go after the "rate_form"
In the old instructions it was placed in before it. Please remove the code from Before the "rate_form" and follow the instructions as to where to place the modified code After that area of the functions file and you should be good.


It works fine :). Thank you for investing so much time and knowledge to keep this great Mod up to date!!
Title: Re: [MOD] Multi Size Download of same image [ver 4.5]
Post by: kar76 on February 18, 2013, 07:21:02 AM
Hello

I have problem to insert tag {prepend_head_title}, it show blank instead of image name.
Don't know why its not work in "multi_popup.html" but it work fine in other places.

Please help
Title: Re: [MOD] Multi Size Download of same image [ver 4.5]
Post by: budduke on February 19, 2013, 12:17:25 AM
Hello

I have problem to insert tag {prepend_head_title}, it show blank instead of image name.
Don't know why its not work in "multi_popup.html" but it work fine in other places.

Please help

I have updated the original code to version 4.6...
in the instructions, look for the last replace in the download.php file and replace it with the updated code.
Let me know if that works or not because I have not tested it yet on my end.
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: kar76 on February 19, 2013, 10:22:20 PM
Quote
I have updated the original code to version 4.6...
in the instructions, look for the last replace in the download.php file and replace it with the updated code.
Let me know if that works or not because I have not tested it yet on my end.


Its not worked.  it only show - of code "prepend_head_title"        => $image_name . " - "

Like this - sitename
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: budduke on February 20, 2013, 12:25:19 AM
@kar76,
I must have fell asleep while doing that one. I modified my original code again...
in the download.php file look for this area
Quote
Also on the first line of the "look for" code above (new replace for version 4.4)
add new code to the end of the first line so it looks like this (Updated the code for version 4.6)
I added the ,image_name to that line of code

Now it should be working for you. I tested it on my test server just to make sure  :oops:
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: kar76 on February 20, 2013, 09:07:13 AM
Yes it working now.

And more problem i noticed in this mode, it related to "0=dropdown"  links.
I noticed that when someone access dropdown links trough mobiles it download nothing
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: kar76 on February 26, 2013, 06:36:24 AM
Does anyone know why drop down menu link download nothing (0 files ) , when download by mobiles.

I use "0=dropdown" option and check it through mobile "Samsung c3312"  and found that no image are downloading, instead it show blank files in mobile.
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: budduke on February 27, 2013, 12:23:19 AM
Does anyone know why drop down menu link download nothing (0 files ) , when download by mobiles.

I use "0=dropdown" option and check it through mobile "Samsung c3312"  and found that no image are downloading, instead it show blank files in mobile.

Sorry, did not see your edit on the post above this one...
I tested it with my android phone and you are correct. I have been researching, trying to figure out what the difference is between a mobile phone browser and a desktop but not having much luck. It seems the mobile does not get the file size when using the dropdown list but the desktop does.
I do not have any time to play with the code till the weekends but will post it when I figure it out. Unless someone else has a quick idea they can post/PM me?
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: kar76 on February 27, 2013, 11:14:49 AM
is there major difference between between drop down  links and text link?
Text links work fine, only problem occurred by drop down  links.
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: budduke on February 28, 2013, 12:05:56 AM
is there major difference between between drop down  links and text link?
Text links work fine, only problem occurred by drop down  links.

The dropdown list is submitting a form to the code instead of a download link. Not sure if that is where the problem is or not for the mobile browsers.

Update: If you install the opera mini browser on your phone it works fine with the dropdown lists so it does appear that there are limitations in the other browsers on the phones from what I have been reading. Will look into it further to see if there is a workaround that I can come up with.
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: kar76 on February 28, 2013, 05:58:07 AM
Quote
If you install the opera mini browser on your phone it works fine with the dropdown lists

I don't know about latest opera mini but i have version 6.5.27510 which also show empty file. And i can not update it 8O
I update it before and my browser started to malfunction so i reset to original.
Title: Re: [MOD] Multi Size Download of same image [ver 4.6]
Post by: budduke on March 02, 2013, 07:31:24 PM
Quote
If you install the opera mini browser on your phone it works fine with the dropdown lists

I don't know about latest opera mini but i have version 6.5.27510 which also show empty file. And i can not update it 8O
I update it before and my browser started to malfunction so i reset to original.

I have updated the code to version 4.7 with the fix included...
To save yourself all the trouble, I only changed on spot of code in to fix the issue.
in the functions.php file
look for...
Code: [Select]
<form action='".$site_sess->url(ROOT_PATH."download.php")."' method='post'".$multi_download_var['target'].">Change to...
Code: [Select]
<form action='".$site_sess->url(ROOT_PATH."download.php")."' method='get'".$multi_download_var['target'].">
in other words change the method= from 'post' to 'get' and things should start working for you.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: kar76 on March 02, 2013, 07:55:33 PM
Work perfectly now. :)
You are the best.


I am facing one more trouble and its related to this mode only.

You see i want to use tags  {width}x{height}   and   {image_file_size}  these tags work everywhere except multi_popup.html

Can you fix this issue?
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on March 03, 2013, 08:46:19 PM
I am facing one more trouble and its related to this mode only.

You see i want to use tags  {width}x{height}   and   {image_file_size}  these tags work everywhere except multi_popup.html

Can you fix this issue?

The popup window was designed because someone requested it so they could put ads above/below the downloaded image and not to recreate the details page all over again.
I do see the reason you are asking for the filesize and dimensions because with this mod they are different then what is displayed on the details page.
I am not trying to recreate ALL the data that is displayed on the details page, at this point the user just wants to download the image...

I am not making this request part of the original MOD but here is the fix for anyone interested in using it. I do not think this will work if your images are stored on remote servers. I have not had time to test that part of it but it works fine for local files...
The last insert in the download.php file...
replace the entire insert with this one...
Code: [Select]
//MOD multi download for popup window
if (($multi_download_var['target']<>"") && $size){
   $meta_keywords  = !empty($image_row['image_keywords']) ? implode(", ", explode(",", $image_row['image_keywords'])) : "";
$meta_description = !empty($image_row['image_description']) ? strip_tags($image_row['image_description']) . ". " : "";
$image_name = format_text($file['file_name'],2);
$file_size = "n/a";
if ($file_size = @filesize($file['file_path'])) {
$file_size = format_file_size($file_size);
}
else {
$file_size = get_remote_file_size($file['file_name']);
}
$image_info= @getimagesize($file['file_path']);
$site_template->register_vars(array(
"img_url" => $file["file_path"],
"site_name" => $config['site_name'],
"charset" => $lang['charset'],
"direction" => $lang['direction'],
"detail_meta_description"   => $meta_description,
            "detail_meta_keywords"      => $meta_keywords,
            "prepend_head_title"        => $image_name . " - ",
"width"=> $image_info[0],
"height"=> $image_info[1],
"image_file_size"=>$file_size,
"image_name"=>$image_name,
"lang_file_size" => $lang['file_size']
));
$site_template->print_template($site_template->parse_template("multi_popup"));
}
else{
        send_file($file['file_name'], $file['file_path']);
     }
//END MOD multi download for popup window

and this is the multi_popup.html I came up with to display the info...
Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{direction}">
<head>
<title>{prepend_head_title}{site_name}</title>
<meta http-equiv="content-type" content="text/html; charset={charset}">
<meta name="description" content="{detail_meta_description}{site_name}">
<meta name="keywords" content="{detail_meta_keywords}">
</head>
<body>
<table align=center">
<TR>
<TD align="center"><img src="{img_url}"></img></TD>
</TR>
<TR>
<TD align="center">{image_name}</TD>
</TR>
<TR>
<TD align="center">{lang_file_size}&nbsp;&nbsp;{image_file_size}</TD>
</TR>
<TR>
<TD align="center">Dimensions:&nbsp;&nbsp;{width} X {height}</TD>
</TR>
</TABLE>
</body>
</html>
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on July 13, 2013, 09:59:08 AM
Mod works great except when using the drop down menu there is just a small blank square instead of a button saying download. Is this normal?
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on July 13, 2013, 07:41:25 PM
Mod works great except when using the drop down menu there is just a small blank square instead of a button saying download. Is this normal?
Can I see a link to see it in action? What browser are you using. It should display correctly...
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on July 13, 2013, 11:07:57 PM
http://www.emanoncreations.com/categories.php?cat_id=168
This is the only category I have it activated on for now. I tried
in FF, Chrome and IE
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on July 14, 2013, 12:03:18 AM
http://www.emanoncreations.com/categories.php?cat_id=168
This is the only category I have it activated on for now. I tried
in FF, Chrome and IE

did you do the insert for the lang\english\main.php file?
If you are using a different language for your site then it will need to go into the main.php file in that language folder after you google translate the words.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on July 14, 2013, 01:29:29 AM
That did it  :!: TY so very much! Don't know how I missed that! 
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 05, 2013, 10:13:39 PM
For some reason I no longer have the drop down menu to select sizes it was there last night and I went on today and it is gone.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 05, 2013, 10:59:16 PM
For some reason I no longer have the drop down menu to select sizes it was there last night and I went on today and it is gone.

When I looked at the source of your page. the info between the multidownload is blank...
Did you change anything last night? Can you try changing to one of the buttons instead of the dropdown to troublehoot any better.
this is what I saw in the source of your page...
Code: [Select]
<!-- Mod multi downloads -->
           
                            <!-- end mod-->
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 05, 2013, 11:06:29 PM
When I changed it back the normal download button is there. I didn't change anything but I am also having a problem creating new categories and sub categories. Wonder if there is something more going on?
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 05, 2013, 11:17:24 PM
When I changed it back the normal download button is there. I didn't change anything but I am also having a problem creating new categories and sub categories. Wonder if there is something more going on?

I would make sure your language files are still OK and then start backtracking on any changes you might have made to the site lately.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 05, 2013, 11:21:43 PM
I did check the lang file as I had problems in that area before...LOL Everything seemed fine. The only other mod I added lately was the one to view thumbnails at regular size. Everything seemed fine last night other then I could not add a new category. So I have no idea but will double check script. TY
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 05, 2013, 11:37:58 PM
I did check the lang file as I had problems in that area before...LOL Everything seemed fine. The only other mod I added lately was the one to view thumbnails at regular size. Everything seemed fine last night other then I could not add a new category. So I have no idea but will double check script. TY
If you zip your changed files and send me a link I will take a look, may have to be tomorrow night. I have a few recorded shows I have to catch up on tonight.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 06, 2013, 12:09:55 AM
How about if I just give you access to my site as I really do not remember everything I changed. The only other thing I did was removing the option to add comments as I was getting a lot of spam.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 06, 2013, 12:29:17 AM
How about if I just give you access to my site as I really do not remember everything I changed. The only other thing I did was removing the option to add comments as I was getting a lot of spam.
I just created an account called budduke on your site if you can make me an admin so I can see what is happening in the admin area for creating categories.
Also, PM me some FTP info so I can look at your files. I will see if I can work it in the next couple of days.

Regarding Spam,
My site was also getting hit with spam in the comments. It seemed they created a script that created a new user and then started posting comments all over the place. Easy to delete when I sorted the comments by date/time. Became a nusance in the last couple of weeks so I changed the new user registration to "admin approval" and posted a message on my main page to tell real people to e-mail me after they register so I know they are a real person and that seems to have stopped all the spam so far. I do get 7 or 8 activation notices a day but I just go in a delete the accounts. I may try changing over to recaptcha on the comments to see if that does anything but you would think they would have something better to do then post garbage on other peoples sites.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 06, 2013, 12:40:23 AM
I did all the above. I changed my detail page back to normal download buttons for now so people can still download files. Thank You so much!
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 06, 2013, 01:57:09 AM
I did all the above. I changed my detail page back to normal download buttons for now so people can still download files. Thank You so much!

There seemed to be stuff missing in this users functions.php file. Once I readded them, everything started working again.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: PamBreeze on August 21, 2013, 10:40:12 PM
Okay it me the "Pest" again! :lol: I went to add new categories and for some reason it won't allow me to choose a multi-size download option. Well actually it lets me choose it, it just won't save it. The only thing I added was the cloud keyword mod. Everything else is still there and working fine. Any Ideas? Thank You!

Never Mind Figured It Out!  8O
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: Szooguun on August 26, 2013, 11:45:43 AM
The mod works great but after the change in global.php:

$ multi_download_var ['target'] = "";
  on
$ multi_download_var ['target'] = _blank;

image opens in the same window. What can I do to pop up in another window?
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 26, 2013, 11:54:52 AM
The mod works great but after the change in global.php:

$ multi_download_var ['target'] = "";
  on
$ multi_download_var ['target'] = _blank;

image opens in the same window. What can I do to pop up in another window?

Try...
$ multi_download_var ['target'] =" _blank";
Notice the quotes...
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: Szooguun on August 26, 2013, 12:04:55 PM
The mod works great but after the change in global.php:

$ multi_download_var ['target'] = "";
  on
$ multi_download_var ['target'] = _blank;

image opens in the same window. What can I do to pop up in another window?

Try...
$ multi_download_var ['target'] =" _blank";
Notice the quotes...


Also open in the same window.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on August 26, 2013, 12:21:43 PM
I would need to see a link to see your site in action...
either post or PM a link.

UPDATE:
where is my brain tonight  :?:
replace that code with...
Code: [Select]
$ multi_download_var ['target'] =" TARGET = '_blank' ";Sorry about that...
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: Szooguun on August 27, 2013, 12:07:05 PM
I would need to see a link to see your site in action...
either post or PM a link.

UPDATE:
where is my brain tonight  :?:
replace that code with...
Code: [Select]
$ multi_download_var ['target'] =" TARGET = '_blank' ";Sorry about that...

Thank you. It works great.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: SilverShadow on December 05, 2013, 12:49:19 AM
Thanks for the updates and your outstanding efforts, I've your mod installed on my gallery long ago, its V4 I believe as I've the grouped download.. is there a way to change how it looks like the attached image!
Thanks in advance.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on December 06, 2013, 12:29:41 AM
Thanks for the updates and your outstanding efforts, I've your mod installed on my gallery long ago, its V4 I believe as I've the grouped download.. is there a way to change how it looks like the attached image!
Thanks in advance.

I did not see an attached image on your post so I am assuming you are talking about the image on my first post with the different layouts?
You can change to the text links and image button links by changing the variable in the code in the global.php file at the beginning of the mod.
change
Code: [Select]
$multi_download_var['type'] = 0; //0=dropdown, 1=text links, 2=image linksChange the 0 to a 1 for text links or change the 0 to a 2 for the button links.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: SilverShadow on December 06, 2013, 02:34:42 AM
Here comes the man :)
Thanks for your help, and yes this is what I exactly was looking for, highly appreciated..
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: wallward on February 07, 2014, 06:50:25 PM
thank you for update
I using "[MOD] On-fly image annotation ( watermark)" and i Want use source image with watermark for download, how to this
thank you  budduke  :)
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on February 07, 2014, 09:35:23 PM
I using "[MOD] On-fly image annotation ( watermark)" and i Want use source image with watermark for download, how to this

Just glancing over the on-fly mod. It looks like it places a watermark on the thumbnail that is used on the details page, but when you download the actual image the watermark is removed.
This mod should work the same alongside my mod because my mod does not do anything with the thumbnail.
Not sure if that is your question or not.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: wallward on February 07, 2014, 11:12:05 PM
budduke if possible please check PM  :wink:
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: budduke on February 08, 2014, 01:59:07 AM
@wallward,
There is annotation already built in by an earlier request...
if you install this mod
http://www.4homepages.de/forum/index.php?topic=13719.0 (http://www.4homepages.de/forum/index.php?topic=13719.0)
Then it will add the annotation as the resized images are created.

I do not think it will work with the on the fly because my mod does not even create the resized image until it is called in the download.php file
It may be possible using the popup template.
Let me know if the above mod does not give you what you are looking for and I may have time in the next few days to see what I can do with the popup template.
Title: Re: [MOD] Multi Size Download of same image [ver 4.7]
Post by: netspider on April 09, 2014, 04:21:37 PM
for me somehow it didn't work, don't where i mess it up.
but when i select original images its downloading thumb not original and also if i select any of the size it convert thumb not the original image.

Did some one faced same issue ?