• [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 431978 times)

0 Members and 1 Guest are viewing this topic.

Offline lona_jasty

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #30 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

Offline budduke

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

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!

Buddy Duke
www.budduke.com

Offline lona_jasty

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #32 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

Offline budduke

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

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Multi Download of same image
« Reply #34 on: November 09, 2008, 03:31:31 PM »

Offline Computerman

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #35 on: January 05, 2009, 01:56:02 AM »
Ok...I resolved my problem
« Last Edit: January 05, 2009, 06:52:44 PM by Computerman »

Offline lapas

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #36 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?

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 Download of same image
« Reply #37 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.
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 Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #38 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)
I m not a  Programmer.
          But
I m a Good Learner.

Offline DjeckMcNil

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #39 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?

Offline budduke

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

Offline DjeckMcNil

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #41 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

Offline budduke

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

Offline DjeckMcNil

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
Re: [MOD] Multi Download of same image
« Reply #43 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.

Offline budduke

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