• [MOD] Multi Size Download of same image [ver 4.7] 5 0 5 1
Currently:  

Author Topic: [MOD] Multi Size Download of same image [ver 4.7]  (Read 433078 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #180 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...
Buddy Duke
www.budduke.com

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #181 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #182 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..
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #183 on: September 27, 2010, 07:28:16 AM »
Thanks V@no, I fixed it..
its working fine now :)

Offline izarkov

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #184 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


Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #185 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.
Buddy Duke
www.budduke.com

Offline chintan100

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #186 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.
« Last Edit: November 30, 2010, 10:11:45 AM by chintan100 »

Offline izarkov

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #187 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.... :(

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #188 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...
« Last Edit: December 01, 2010, 01:38:42 AM by budduke »
Buddy Duke
www.budduke.com

Offline chintan100

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #189 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))

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #190 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
Buddy Duke
www.budduke.com

Offline chintan100

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #191 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

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #192 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??

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #193 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.
Buddy Duke
www.budduke.com

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #194 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..