4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: V@no on January 08, 2003, 01:58:45 AM
-
This mod will let visitors download all images from a category.
Almost the same as Lightbox, exept that it will download pictures that are desplaeyed on one page (u can see what I mean here (http://come.no-ip.com/categories.php?cat_id=78) look at ZIP button near UPLOAD).
Why is it BETA? - because I've tested only on my own server/system, and it didnt work well with too many images or too big filesizes. It might be because of wrong my server configuration....dont know.... 8O
so, anyway.
1. Open categories.php file.
1.1. Find:$site_template->register_vars(array(
"msg" => $msg,
Replace with:if (!check_permission("auth_download", $cat_id)) {
$download_button = "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
}
$site_template->register_vars(array(
"download_button" => $download_button,
"msg" => $msg,
2. Open download.php file.
2.1 Find:
$user_access = get_permission();
Add after:include(ROOT_PATH.'includes/page_header.php');
if (!function_exists('get_file_data'))
{
function get_file_data($filename)
{
return file_get_contents($filename);
}
}
2.2. Find: else {
echo $lang['download_error']."\n<!-- EMPTY FILE PATH //-->";
exit;
}
}
Add after:elseif ($action == "page") {
if (!function_exists("gzcompress") || !function_exists("crc32")) {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT ".$_GET['offset'].", $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$page_download = "";
while ($image_row = $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql = trim($page_download, ", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
$sql = "SELECT cat_id, image_media_file, image_download_url
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
$result = $site_db->query($sql);
if ($result) {
include(ROOT_PATH."includes/zip.php");
$zipfile = new zipfile();
$file_added = 0;
while ($image_row = $site_db->fetch_array($result)) {
if (!empty($image_row['image_download_url'])) {
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
$file_path = $image_row['image_download_url'];
$file_name = basename($image_row['image_download_url']);
}
}
elseif (is_remote($image_row['image_media_file'])) {
$file_path = $image_row['image_media_file'];
$file_name = basename($image_row['image_media_file']);
}
else {
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
}
if (!empty($file_path)) {
@set_time_limit(120);
if (!$file_data = get_file_data($file_path)) {
continue;
}
$zipfile->add_file($file_data, $file_name);
$file_added = 1;
unset($file_data);
}
}
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = time().".zip";
$file['file_data'] = $zipfile->file();
$file['file_size'] = strlen($file['file_data']);
}
else {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
}
}
3. Open /templates/yourtemplate/categories.html
3.1. Add {download_button} anywhere u want.
If u wish make it without limitation (download whole category) then u'll need change code: ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
with this: ORDER BY ".$config['image_order']." ".$config['image_sort']."";
if u want limit downloaded pictures to your own desired number, change: LIMIT $offset, $perpage";
to this: LIMIT $offset, X";
where X is number u want.
-
yes very good option thk v@eno
-
well, yes, but if u look at the word this way...;)
-
I have this DB Error when click in Download button.
The problem is here ( LIMIT $offset, $perpage"; )... What is The solution please?
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id FROM galerias_images i, galerias_categories c LEFT JOIN galerias_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 167 AND c.cat_id = i.cat_id ORDER BY image_date DESC LIMIT , 12
Algo está equivocado en su sintax cerca ' 12' en la linea 6
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /var/www/localhost/xwall/htdocs/galerias/includes/db_mysql.php on line 231
function get_numrows($query_id = -1) {
if ($query_id != -1) {
$this->query_id = $query_id;
}
return mysql_num_rows($this->query_id);
}
DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM galerias_images WHERE image_active = 1 AND image_id IN (,) AND cat_id IN (0, 520, 15, 554, 626, 262, 121, 549, 458, 318, 491, 16, 263, 35, 34, 636, 131, 651, 366, 633, 61, 56, 264, 122, 170, 132, 195, 2, 14, 650, 647, 617, 102, 348, 30, 145, 154, 308, 313, 101, 103, 558, 31, 389, 315, 646, 185, 113, 464, 365, 624, 622, 471, 40, 345, 163, 197, 81, 209, 114, 104, 265, 33, 248, 133, 63, 569, 28, 411, 410, 58, 266, 349, 631, 123, 614, 299, 130, 280, 615, 124, 71, 134, 80, 55, 269, 254, 359, 526, 363, 259, 337, 597, 364, 146, 548, 388, 100, 118, 161, 105, 67, 619, 106, 26, 268, 606, 566, 612, 70, 270, 595, 584, 621, 394, 466, 79, 135, 152, 153, 155, 162, 156, 157, 158, 159, 151, 271, 272, 72, 369, 216, 107, 609, 41, 387, 628, 361, 635, 632, 147, 571, 403, 48, 119, 68, 481, 412, 66, 358, 553, 610, 422, 205, 126, 167, 601, 296, 568, 567, 649, 604, 342, 346, 99, 371, 115, 547, 234, 494, 534, 630, 83, 120, 75, 642, 1, 274, 620, 192, 117, 18, 128, 127, 76, 627, 367, 19, 275, 194, 98, 521, 556, 69, 20, 276, 207, 24, 160, 77, 38, 141, 111, 78, 368, 144, 150, 32, 43, 89, 142, 277, 125, 625, 44, 82, 27, 29, 47, 39, 60, 603, 508, 404, 279, 377, 198, 116, 17, 468, 616, 62, 37, 186, 282, 456, 84, 648, 563, 140, 178, 305, 401, 137, 409, 284, 643, 335, 551, 640, 602, 252, 261, 210, 25, 285, 360, 465, 641, 644, 148, 479, 623, 591, 564, 109, 618, 85, 138, 139, 57, 637, 362, 168, 639, 129, 21, 287, 149, 110, 634, 420, 599, 49, 86, 645, 434, 74, 629, 638, 370, 112, 249, 244, 164)
Algo está equivocado en su sintax cerca ') AND cat_id IN (0, 520, 15, 554, 626, 262, 121, 549, 458, 318, ' en la linea 3
-
I've updated step 2.2
try now.
-
Thanks V@no for your help, all OK Now. :D
-
Hello,
After installing this mod, when you are in a category with no images, if you click the download button you get a DB error ( DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 12, 14, 2, 3, 13, 15, 16, 4, 7, 8, 9, 10, 11) ).
I think if the category contains no images, download button should be hidden. Steps to get this (after having installed the mod):
1) open categories.php
2) Find
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
3) Add before
if ($cat_cache[$cat_id]['num_images'] > 0)
That's it.
You could as well decide to show an inactive download button instead of not showing it.
BTW: Useful mod. Thanks V@no.
Regards.
-
if ($cat_cache[$cat_id]['num_images'] > 0)
With this type of if statement, never forget to put it like this instead :
if ($cat_cache[$cat_id]['num_images'] > 0) {
You missed the opening bracket sign. ;)
The other step is to close the if statement, with a closing bracket sign after the command has been commented out.
-
With this type of if statement, never forget to put it like this instead :
if ($cat_cache[$cat_id]['num_images'] > 0) {
You missed the opening bracket sign. ;)
The other step is to close the if statement, with a closing bracket sign after the command has been commented out.
wrong, its not nececerly.
if you dont use {} brackets, only one line that followed after the condition statement will be used in the condition and the rest of the code will be treated as not related to the condition at all.
http://php.net/manual/en/language.control-structures.php#control-structures.if
-
Is this with 4images v1.71 ?
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
since I cannot find it from my categories.php file.
-
With this type of if statement, never forget to put it like this instead :
if ($cat_cache[$cat_id]['num_images'] > 0) {
You missed the opening bracket sign. ;)
The other step is to close the if statement, with a closing bracket sign after the command has been commented out.
wrong, its not nececerly.
if you dont use {} brackets, only one line that followed after the condition statement will be used in the condition and the rest of the code will be treated as not related to the condition at all.
http://php.net/manual/en/language.control-structures.php#control-structures.if
Well, I can agree it is a good programming practice to always put between brackets code within an IF (and a a while, for, etc.), but certainly, as long as there is a single line, brackets are not necessary.
Is this with 4images v1.71 ?
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
since I cannot find it from my categories.php file.
This line is in categories.php if you have installed the mod. See V@no's post (the one which started this thread).
-
Ah ! yes, found it. In the else statement. ;)
-
Can't see the demo. There's no Zip button near upload.
The description is also contradictory. At one place it says "Download all images in a category" and in another it says "Download pictures displayed on one page". Clearly not the same thing. Which does this do?
Thanks
-
1.1. Find:$site_template->register_vars(array(
"mode" => ((!empty($mode)) ? "&mode=".$mode : ""), "clickstream" => $clickstream,
Replace with:if (!check_permission("auth_download", $cat_id)) {
$download_button = "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
}
$site_template->register_vars(array(
"download_button" => $download_button,
"mode" => ((!empty($mode)) ? "&mode=".$mode : ""), "clickstream" => $clickstream,
I can´t find this code on categories.php... i have 4images 1.7.1 what can i do??
-
Correct. In categories.php file,
find :
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
replace with :
/-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
if (!check_permission("auth_download", $cat_id)) {
$download_button = "<img src=\"".get_gallery_image("download_zip_off.gif")."\" border=\"0\" alt=\"\" /></a>";
}
else {
$download_button = "<a href=\"".$site_sess->url(ROOT_PATH."download.php?action=page&cat_id=".$cat_id."&offset=".$offset."")."\"><img src=\"".get_gallery_image("download_zip.gif")."\" border=\"0\" alt=\"\" /></a>";
}
$site_template->register_vars(array(
"msg" => $msg,
"download_button" => $download_button,
"mode" => ((!empty($mode)) ? "&mode=".$mode : ""), "clickstream" => $clickstream
));
-
Ok.. i speak english very bad... so i´ll try..
jeje
in download.php
mmm if i put this code...
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT ".$_GET['offset'].", $perpage";
all works fine...
BUT if i put this other...
ORDER BY ".$config['image_order']." ".$config['image_sort'].";
I have this error
Parse error: parse error, unexpected '\"' in /data/members/paid/m/i/misimagenes.net/htdocs/www/download.php on line 280
and the line 280 .... $page_download = "";
what can i do?? i want download ALL the images of the category... not the images of this page...
please help.. it´s so smarty
-
I try dowload 176 images and....
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 35265 bytes) in /data/members/paid/m/i/misimagenes.net/htdocs/www/includes/zip.php on line 81
line 81 said
$new_offset = strlen(implode('', $this->datasec));
:?: :?: :?: :?
-
This will of course return a parsing error message. ;)
To correct this,
replace :
ORDER BY ".$config['image_order']." ".$config['image_sort'].";
simply with :
ORDER BY ".$config['image_order']." ".$config['image_sort'];
As for :
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 35265 bytes) in /data/members/paid/m/i/misimagenes.net/htdocs/www/includes/zip.php on line 81
That is a memory buffer issue from the server end. You must report this error to your web hosting party.
-
Hi V@no
Strange but i cant find the code in categories.php to do step 1.1
$site_template->register_vars(array(
"mode" => ((!empty($mode)) ? "&mode=".$mode : ""), "clickstream" => $clickstream,
I am using version 1.7.1 and may be due to some other mod i have chnaged this line. But now in order to get this mod to work. What exactly i should chnage ??
I am attaching my categories.php fiile. Please help me out.
-
I've updated the original post. the searching lines should be:
$site_template->register_vars(array(
"msg" => $msg,
-
Thanks for quick looking. :)
It works absolutely fine. Thanks V@no
-
Hi there,
i become this one when i will download the complete cat or a single picture
i click on the download button and i can´t download the pic but it load a site with this...
PKp˜¹à‹õß}èxl–Ëé…~ʼ;{åöÿ8lýrãñ„Ÿ?š³hñgK–®úÊuµ›û¦Í^´o¶lÝá»s—ßî=þAÁ!¡aß:q"2*údLì™Ä¤dî�gS~ùõ·óÒÒ/^»ž•}Cx3'7/ÿ^AaQqIiUuMm�ä¯ú†=n|òôYSóËöŽÎW]ݪž7oßõéôýƒCc&óûñ Ìb�œŠkeÆ´ÿûøÿŒËÄ5ýƒf|0k*®iÓ¹Spø`æë?\ð]à¬c§]6ü4{áöÌ»þùhåÆƒ£NÇÚæ,úrÓ›UcS¡ý7²ÿ�ýüÙÿØÿWå“Ó@òf8PÛßürL€�aF\Zg´Êc™o¬%Åjš‡w¶�~>Ch‘³2EÆÀꌉÕvÊ‹A;ÅSÃiÈ^>pž‡œ=‰Wñ.Û§MRUÍëxŠgóº,ç¼hVr)½¶ítáON3óVÌ«»"æ²·xÕþðH��b|9í’$¾ê'¶8¦ð,Ä(i‚ñƒß‘‘Ö7E^93ÚN‰Nò>^„×~þ-¶b(�7¾¸Ü_t-=õõæ<YK‹5„7«Ký ‰:W�¦žx‡Ýö¢¿ÊÏ]?MÌP`'¡Ì¤±áW+b§\*Îhl�¾dÞůþð=6eîórÛæmmŸ£Û)¸4¦Rª³Â¯ƒû’þgx/ÁƒÃøÃ¿wHôšº+",ž%c²ŸÕt}ÕúFPÓxÿÆY ÛÐëàíïß›—Aݬw)+‰· t\[lÁ<’í/ ŠÜ…‡ÃÈi¾÷èÇ7b‚‰!�áŠÄÉv”êêŒvJTîCÚØ*êBß-thB{å²xÔSºKy¼S»�w <<-]‰R8liXÂªï› Êì”Åç5%’~õÁBP#ÐÜ£ù¾Äeª¼q«'n§:ö$úb‹ìíl/#éÎÅ�ˆI¯uv ڮ涘Bl;¯ªÌô¡“ÊuÏN9[¾t‰=úlVþHÊ«AÞDjLí×ñrs»ü°`äøžÅ¶Y‘ÞýLl¹Ø«/ F3‚f¹ŽAN>m×®Ø)š?•̓@e~ª6Ðoœ‰ÄS«®Êx§ÁäÊ…»�’ß¾%º~*þ?5zÛørtý˜³. ïÉ.Î*X2Ÿjà=OˆGç|¡&�kY^¯Bñcþ‡� ׇ}d2F Y€<��o8¡…=÷¾ý|ß¡k¥�ÓIíÜû0—è¦ÄCºS²îm]X6[Ô“çKRoÔ¬1ä †|‘P›^ñ|ï\ v*à‹Ÿ¨% ú<_•™ölÜ}å>ÄóYzµÅãêÑöôöÏ?˜ÈV‘¨ÆAd¢5$“ÿˆ ë9·µiìú0ô®ãLBja[z|O$bÛœ¬>xºÐÛêk¥¢!Ú¼x<tЫÍ>VßÁ ÿ²‹Ò¢“ #$eÄŸ°Öñ�„�däU‘Ô–½ž8ü$0ã_Ö&Å…W¯NÊ#ÃG�§�ü‚(Hj;òê†r9ÂTP¹>á»-æ¶€Æ]>£³h[Ž�t¾å—UƒÊËr;î“| îUñV-sŒ—�]²OŠèºí”Ó§ o]ŽMxVW<Ðbî:’wj9³EÒüU¹õ{Ç艕jq~>·Y¬e¾Î Äøï–ÇïèÞ¤~Vq‡c!©¸�˜kdô&Vœúî=Ñ*ÔWÔbÓ œU^Dóq½ñÙ`VýÛó‘5 Y¶œu»¾ý@ Kj5誷Èmáäþª6wÉɆÕ÷ �ƒÁÁ¡øÕÚ$ãa•&Œ‹3ŒašÊûÝþ éÙÐ1ÙªžÖAÌ#'gé2;åŸðͺf’‘JÌcy¿U²®¹+÷hѲXUÑDA&=�S¹Y©$‘s»¸�ËV“œúà �‰‡ Ð2vËÄå³ùWoü;öðë5铺.<*@-Œà�7«YÕ�ºMUÀ;/‰rÂi6ĸÊ7Â-˜ºþ8ûO�äáÊj4Ä�ôBH4ÓØA»ª ÓÄý´\\ÂQï;(t㢽€8ºò4A*_�M|ÉmM×Ȱ„Ó|' ±yNÑvð6 „- t»øÍj5žÝN´çÄê/ätȘ ã“¶‘›¯Y�ýUt@¹$ˆ?F9(Œ'-zB7زžB0 �—¿iATÀÐ{ÿ”Áò—]£fhŠˆ"£G‡?ãdûÍ7ì 'ÛÙèsìKµ‹5‡k§<°9%/‘ 8bÝ@åßìì®4º³¥ Sþ<9-ÊÊH"4h™ }ØBÙŠ–&t±‹+4q$òHu}·4Æ·–Ð”Ž¨˜Ó«Á†<·HZ-Ü[ž¿üG³Ã’„gQ¥";å5Ô[#¹³7>$6§ÝàfªÀç «¤ÔN™ªò&k>Æ|eu£Û)Í5vаG|fÛ)6Ó,4Ø)>Œh,7ã $Šê‰nı¼Æ„®V$ŠZFú'÷Ô}q²ÊÕzWb"}xöÝö¥33¦~h�/Sl°á±R…œ%B‹HF ·DY/ŒÆ7¦×üOc¥7óWÚç@JÓú£ 3_—Ó–Üa»df[éôüR }|&᪠ÂÝyž8’-Ð×À=)9Tƒ{T߃�®—¬¿—V\‚Ř]•Äc5ö²ì^ó%â)«|Æs?•éÕæ•ÆÛÛ�æ "Ç3´ç†Cõ¥®ÒU‘(Ho°(¾ƒ$‰²ôBÌ`X¢³¶ƒ¹Õy#7Ýl8,�[EtjÂVµ~_w¡_eæ@b4´çÈF*;¬z—¦B%äÒžóÊã|`èö¼Ä®NžÎw¸ jhÐÎ4îNµé@z5�„vEãTëmÚÁöæ½sk¢01t‘XÜœ¤~0ô¨7ÏëUÀà!ìúÆ‘Þòª|üå§î ×%%¼krÝN9qƒ0ùávXõ Ì%-÷¹9,\M×¥dê-
-
Hi
So far this is working just fine.
Just one thing that downloading images using this do not count towards total no of downloads. Neither it add to the picture download itself.
Is this normal or i am missing something ?
-
Thats why its "beta" ;)
-
Thats why its "beta" ;)
I was just confirming. No problem to me if it doesn’t.
Still worth to have it. :)
I hope it will be soon out of BETA stage and who knows we will have few more exciting options with it :wink:
-
First of all V@no this is such a nice mode that it should be out of Beta soon. (It’s been a long time its still in beta)
Now here is my problem.
I have used "[MOD] Download limit v1" . I used it only to restrict Guest to download 5 images in 24 hours.
Register members can download any no. of pictures. I made changes as u suggested in that thread.
The problem is, when a member uses this mod "Category/Page Download" He get only 5 images in his zip. No matter how many are listed in the page. V@no could u please help me here. This is a "Must Have" mod for me.
-
1) I dont see the point of having download limit mod and allow them download as many images as they wish by this mod...
2) if you still want to remove restrictions from this mod, then try to reinstall it (this mod only)
-
1) I dont see the point of having download limit mod and allow them download as many images as they wish by this mod...
2) if you still want to remove restrictions from this mod, then try to reinstall it (this mod only)
1) I use "download limit" mode to restrict Guests, not members. So it’s like "Be member and get more"
Edited//
I think Re-Instalation of this mod will work fine.
Sorry for Creating Trouble.
-
Hi V@no
Do you plane to make this Mod out of beta?
It’s such a nice mod & need few more improvements.
Like group permission, count towards “image downloads” & “total downloads” etc
Also its working with “Keep track what each user download”.
Do u plane to do it??
Its on my “wish list” :)
-
Hey.
V@no, another one well done ;)
I have no idea why, but the MOD decided not to work for some reason, so I tried to change the following code
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = time().".zip";
$file['file_data'] = $zipfile->file();
$file['file_size'] = strlen($file['file_data']);
to this one:
if ($file_added) {
@set_time_limit(120);
$file['file_data'] = $zipfile->send(time().".zip");
exit;
I suggest that if anyone encounters an error, to try this (be sure to backup download.php, just in case).
-
Hi! I had this MOD set up on my old site...but for some reason this time around, I can't do it. I'm getting this error:
---------------------------------------
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id FROM 4images_images i, 4images_categories c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 19 AND c.cat_id = i.cat_id ORDER BY image_name ASC
Unknown column 'i.user_id' in 'on clause'
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /chronicled.net/photogalle/includes/db_mysql.php on line 116
DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM 4images_images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 9, 16, 7, 1, 10, 3, 14, 2, 11, 6, 20, 8, 5, 4, 12, 13, 15, 17, 18, 19)
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 ') AND cat_id IN (0, 9, 16, 7, 1, 10, 3, 14, 2, 11, 6, 20, 8, 5, 4, 12, 13, 15, 1' at line 3
------------------------------------
Any ideas?
Thanks!
-
I'm getting the following error message after using this Mod.
Fatal error: Call to undefined function: file() in /home/utwwemed/public_html/galleries/download.php on line 340
On line 340 I have: $file['file_data'] = $zipfile->file();
I'm using 4images Version 1.7.2.
-
Sorry this mod is not compatible with v1.7.2
-
Thought'd you'd say that. :) Ah well, any chance someone could modify it to work with version 1.7.2?
-
Hello!
I would like to push this thread to the top. I could very need such mod for my 4images 1.7.4
-
how I can make to appear an other image in place of this (http://www.djghost.it/tingagallery/templates/blue/images/download_zip.gif)?
-
but download only those images in the page, not are unloaded the entire gategory :cry: :cry:
-
how I can make to appear an other image in place of this (http://www.djghost.it/tingagallery/templates/blue/images/download_zip.gif)?
Find an alternative image you want to use and replace the download.gif with that one. But be sure to rename it to download.gif.
FYI: This file can be found in the images directory within the templates.
-
Has anyone made this work with 1.7.4
-
What is error in v1.7.4 with MOD ?
-
I got it work now with 1.7.4 no problem or mods.
-
Could you please post the code for everyone?
I cant get it to work with 1.7.4 :-(
Thanks!
-
For the Version 1.7.x you must change following line
$file['file_data'] = $zipfile->file();
with this one
$file['file_data'] = $zipfile->send(time().".zip");
After that the MOD doing his job succesfully ;-)
-
I've change this line. Alll files in archive are 0 bytes. What to do? Thanks.
-
It's working. I've add function function get_file_data($file_path) from 1.7.4 to 1.7.6.
But there is another problem. MOD download resized images, but I need dowlload full-size images (data/media/1/download/*.*)
Where can I change the path to files? Thanks.
-
I have just changed to a dedicated server and now this mod seems to have stoped working, I get this error (below) however my lightbox download still works, so very weird.
This is the error.
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id FROM 4images_images i, 4images_Jobs c LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND i.cat_id = 373 AND c.cat_id = i.cat_id ORDER BY image_name ASC LIMIT 0, 40
Unknown column 'i.user_id' in 'on clause'
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/property/public_html/imagemanager/includes/db_mysql.php on line 116
DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM 4images_images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 451, 519, 488, 515, 484, 478, 486, 490, 462, 465, 476, 480, 448, 444, 494, 210, 333, 461, 518, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 554, 555, 561, 249, 446, 166, 341, 248, 247, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 38, 39, 48, 49, 56, 58, 62, 63, 64, 66, 68, 69, 70, 72, 73, 75, 77, 81, 83, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 98, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 121, 122, 123, 124, 125, 126, 127, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 147, 148, 150, 151, 152, 154, 156, 157, 159, 160, 161, 162, 163, 164, 165, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 223, 224, 225, 226, 227, 228, 229, 231, 232, 233, 234, 235, 236, 237, 239, 240, 241, 242, 243, 244, 245, 246, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 326, 327, 328, 329, 330, 331, 332, 334, 335, 336, 337, 338, 339, 340, 342, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 361, 362, 363, 364, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 380, 381, 382, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 439, 432, 433, 434, 435, 436, 437, 438, 440, 441, 442, 443, 445, 447, 449, 450, 452, 453, 454, 455, 456, 457, 458, 459, 460, 463, 464, 466, 467, 468, 469, 470, 475, 477, 479, 481, 482, 483, 485, 487, 489, 493, 495, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 516, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 556, 557, 558, 559, 560)
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 ') AND cat_id IN (0, 451, 519, 488, 515, 484, 478, 486, 490, 462, 465, 476, 480, ' at line 3
Any help or ideas would be great
-
hi,
try to change
http://www.4homepages.de/forum/index.php?topic=3479.0
2.2 (Add after:) code:
to
elseif ($action == "page") {
if (!function_exists("gzcompress") || !function_exists("crc32")) {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT ".$_GET['offset'].", $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$page_download = "";
while ($image_row = $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql = trim($page_download, ", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
$sql = "SELECT cat_id, image_media_file, image_download_url
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
$result = $site_db->query($sql);
if ($result) {
include(ROOT_PATH."includes/zip.php");
$zipfile = new zipfile();
$file_added = 0;
while ($image_row = $site_db->fetch_array($result)) {
if (!empty($image_row['image_download_url'])) {
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
$file_path = $image_row['image_download_url'];
$file_name = basename($image_row['image_download_url']);
}
}
elseif (is_remote($image_row['image_media_file'])) {
$file_path = $image_row['image_media_file'];
$file_name = basename($image_row['image_media_file']);
}
else {
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
}
if (!empty($file_path)) {
@set_time_limit(120);
if (!$file_data = get_file_data($file_path)) {
continue;
}
$zipfile->add_file($file_data, $file_name);
$file_added = 1;
unset($file_data);
}
}
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = time().".zip";
$file['file_data'] = $zipfile->file();
$file['file_size'] = strlen($file['file_data']);
}
else {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
}
}
-
Weird, I have made the change but get this error now-
Fatal error: Call to undefined method Zipfile::file() in /home/property/public_html/imagemanager/download.php on line 353
this is my download.php file
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: download.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. *
* *
*************************************************************************/
$main_template = 0;
$nozip = 1;
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
function get_remote_file($url) {
$file_data = "";
$url = @parse_url($url);
if (isset($url['path']) && isset($url['scheme']) && eregi("http", $url['scheme'])) {
$url['port'] = (!isset($url['port'])) ? 80 : $url['port'];
if ($fsock = @fsockopen($url['host'], $url['port'], $errno, $errstr)) {
@fputs($fsock, "GET ".$url['path']." HTTP/1.1\r\n");
@fputs($fsock, "HOST: ".$url['host']."\r\n");
@fputs($fsock, "Connection: close\r\n\r\n");
$file_data = "";
while (!@feof($fsock)) {
$file_data .= @fread($fsock, 1000);
}
@fclose($fsock);
if (preg_match("/Content-Length\: ([0-9]+)[^\/ \n]/i", $file_data, $regs)) {
$file_data = substr($file_data, strlen($file_data) - $regs[1], $regs[1]);
}
}
}
return (!empty($file_data)) ? $file_data : 0;
}
function get_file_data($file_path) {
global $script_url;
ob_start();
@ob_implicit_flush(0);
@readfile($file_path);
$file_data = ob_get_contents();
ob_end_clean();
if (!empty($file_data)) {
return $file_data;
}
elseif (is_remote_file($file_path)) {
$file_data = get_remote_file($file_path);
}
else {
if (!file_exists($file_path)) {
$file_path = preg_replace("/\/{2,}/", "/", get_document_root()."/".$file_path);
}
if (file_exists($file_path)) {
$file_size = @filesize($file_path);
$fp = @fopen($file_path, "rb");
if ($fp) {
$file_data = @fread($fp, $file_size);
@fclose($fp);
}
}
}
if (empty($file_data)) {
if (ereg("^\/", $file_path)) {
preg_match("/^(http:\/\/[^\/]+)/i", $script_url, $regs);
$script_url = $regs[1];
}
$file_data = get_remote_file($script_url."/".$file_path);
}
return (!empty($file_data)) ? $file_data : 0;
}
function send_file($file_name, $file_path) {
$data = get_file_data($file_path);
@session_write_close();
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
if (get_user_os() == "MAC") {
header("Content-Type: application/x-unknown\n");
header("Content-Disposition: attachment; filename=\"".$file_name."\"\n");
}
elseif (get_browser_info() == "MSIE") {
$disposition = (!eregi("\.zip$", $file_name)) ? 'attachment' : 'inline';
header("Content-Disposition: $disposition; filename=\"".$file_name."\"\n");
header("Content-Type: application/x-ms-download\n");
}
else {
header("Content-Disposition: attachment; filename=\"".$file_name."\"\n");
header("Content-Type: application/octet-stream\n");
}
header("Content-Length: ".strlen($data)."\n\n");
echo $data;
}
$file = array();
if ($action == "lightbox") {
if (empty($user_info['lightbox_image_ids']) || !function_exists("gzcompress") || !function_exists("crc32")) {
redirect($url);
}
if (!check_download_token($user_info['lightbox_image_ids'])) {
redirect("index.php");
}
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
$image_ids = array();
$sql = "SELECT image_id, cat_id, image_media_file, image_download_url
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN").get_auth_cat_sql("auth_download", "NOTIN").")";
$result = $site_db->query($sql);
if ($result) {
include(ROOT_PATH."includes/zip.php");
$zipfile = new zipfile();
$file_added = 0;
while ($image_row = $site_db->fetch_array($result)) {
if (!empty($image_row['image_download_url'])) {
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
$file_path = $image_row['image_download_url'];
$file_name = basename($image_row['image_download_url']);
}
}
elseif (is_remote($image_row['image_media_file'])) {
$file_path = $image_row['image_media_file'];
$file_name = get_basefile($image_row['image_media_file']);
}
else {
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
}
if (!empty($file_path)) {
@set_time_limit(120);
if (!$file_data = get_file_data($file_path)) {
continue;
}
$zipfile->add_file($file_data, $file_name);
$file_added = 1;
unset($file_data);
$image_ids[] = $image_row['image_id'];
}
}
if ($file_added) {
if ($user_info['user_level'] != ADMIN) {
$sql = "UPDATE ".IMAGES_TABLE."
SET image_downloads = image_downloads + 1
WHERE image_id IN (".trim(implode(", ", $image_ids)).")";
$site_db->query($sql);
}
@set_time_limit(120);
$file['file_data'] = $zipfile->send(time().".zip");
exit;
}
else {
redirect($url);
}
}
}
elseif ($image_id) {
if (isset($HTTP_GET_VARS['size']) || isset($HTTP_POST_VARS['size'])) {
$size = (isset($HTTP_GET_VARS['size'])) ? intval($HTTP_GET_VARS['size']) : intval($HTTP_POST_VARS['size']);
}
else {
$size = 0;
}
$sql = "SELECT 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);
if (!$image_row || !check_permission("auth_viewcat", $image_row['cat_id']) || !check_permission("auth_viewimage", $image_row['cat_id'])) {
redirect($url);
}
else {
if (!check_permission("auth_download", $image_row['cat_id'])) {
redirect($url);
}
if (!check_download_token($image_id)) {
echo "Hotlinking is not allowed";
exit;
redirect("index.php");
}
}
$remote_url = 0;
if (!empty($image_row['image_download_url'])) {
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
ereg("(.+)\.(.+)", basename($image_row['image_download_url']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = dirname($image_row['image_download_url'])."/".$file['file_name'];
}
else {
$file['file_path'] = $image_row['image_download_url'];
$remote_url = 1;
}
}
elseif (is_remote_file($image_row['image_media_file'])) {
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = dirname($image_row['image_media_file'])."/".$file['file_name'];
}
else {
ereg("(.+)\.(.+)", get_basefile($image_row['image_media_file']), $regs);
$file_name = $regs[1];
$file_extension = $regs[2];
$file['file_name'] = $file_name.(($size) ? "_".$size : "").".".$file_extension;
$file['file_path'] = (is_local_file($image_row['image_media_file'])) ? dirname($image_row['image_media_file'])."/".$file['file_name'] : MEDIA_PATH."/".$image_row['cat_id']."/".$file['file_name'];
}
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);
}
if (!empty($file['file_path'])) {
@set_time_limit(120);
if ($remote_url) {
redirect($file['file_path']);
}
if ($action == "zip" && !eregi("\.zip$", $file['file_name']) && function_exists("gzcompress") && function_exists("crc32")) {
include(ROOT_PATH."includes/zip.php");
$zipfile = new zipfile();
$zipfile->add_file(get_file_data($file['file_path']), $file['file_name']);
$zipfile->send(get_file_name($file['file_name']).".zip");
} else {
send_file($file['file_name'], $file['file_path']);
}
exit;
}
else {
echo $lang['download_error']."\n<!-- EMPTY FILE PATH //-->";
exit;
}
}
elseif ($action == "page") {
if (!function_exists("gzcompress") || !function_exists("crc32")) {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
//-------------------------------------------------------\\
//------- need find out witch pictures are desplayed ----\\
//------ this code was taken from categories.php file ---\\
//----- with some modification-adaption to this script --\\
//------- so, if someone could give me an example --------\\
//------- how to transfer a string from one php file -----\\
//------ to another, I would really appreciated and ------\\
//--------------- modification would be less -------------\\
//----- (I've tryed use global $string; - it didnt work) --\\
//--------------------------------------------------------\\
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$sql = "SELECT i.image_id, i.cat_id, i.user_id
FROM (".IMAGES_TABLE." i, ".Jobs_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.cat_id = $cat_id AND c.cat_id = i.cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT ".$_GET['offset'].", $perpage";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
$page_download = "";
while ($image_row = $site_db->fetch_array($result)){
$page_download .= ", ".$image_row['image_id'];
}
$image_id_sql = trim($page_download, ", ");
//--------------------------------------------------------------\\
//---- the rest of the code was taken from download-lightbox----\\
//--------------------------------------------------------------\\
$sql = "SELECT cat_id, image_media_file, image_download_url
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_download").")";
$result = $site_db->query($sql);
if ($result) {
include(ROOT_PATH."includes/zip.php");
$zipfile = new zipfile();
$file_added = 0;
while ($image_row = $site_db->fetch_array($result)) {
if (!empty($image_row['image_download_url'])) {
if (is_remote_file($image_row['image_download_url']) || is_local_file($image_row['image_download_url'])) {
$file_path = $image_row['image_download_url'];
$file_name = basename($image_row['image_download_url']);
}
}
elseif (is_remote($image_row['image_media_file'])) {
$file_path = $image_row['image_media_file'];
$file_name = basename($image_row['image_media_file']);
}
else {
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
}
if (!empty($file_path)) {
@set_time_limit(120);
if (!$file_data = get_file_data($file_path)) {
continue;
}
$zipfile->add_file($file_data, $file_name);
$file_added = 1;
unset($file_data);
}
}
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = time().".zip";
$file['file_data'] = $zipfile->file();
$file['file_size'] = strlen($file['file_data']);
}
else {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
}
}
else {
echo $lang['download_error']."\n<!-- NO ACTION SPECIFIED //-->";
exit;
}
exit;
?>
-
Fixed it by replacing
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = time().".zip";
$file['file_data'] = $zipfile->file();
$file['file_size'] = strlen($file['file_data']);
}
else {
with
if ($file_added) {
@set_time_limit(120);
$file['file_data'] = $zipfile->send(time().".zip");
-
Hello,
Trying to use this MOD with 4images 1.7.7, when click on download button i get this error.
An unexpected error occured. Please try again later.
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/user3/public_html/includes/db_mysql.php on line 116
An unexpected error occured. Please try again later.
-
try re-do step 2.2
-
This message has been deleted by Rembrandt as spam!
-
try re-do step 2.2
Hi,
iam getting this:
Fatal error: Call to undefined function get_file_data() in /home/www/web0/html/4images/download.php on line 338
Is it working for someone with 1.7.8?
Greetz X23
-
I've updated step 2.1
-
I've updated step 2.1
Hi,
thx but i got this:
Fatal error: Call to undefined method Zipfile::file() in /home/www/web0/html/4images/download.php on line 357
EDIT:
For the Version 1.7.x you must change following line
$file['file_data'] = $zipfile->file();
with this one
$file['file_data'] = $zipfile->send(time().".zip");
After that the MOD doing his job succesfully
After this it was working ;) thx chris
Edit2:
but if download_button is placed in categories.html and i navigate into the first categorie that
is only a container for the subcategories with the images and press the download button in get:
DB Error: Bad SQL Query: SELECT cat_id, image_media_file, image_download_url FROM 4images_images WHERE image_active = 1 AND image_id IN () AND cat_id IN (0, 1, 16, 33, 2, 9, 29, 4, 6, 28, 7, 27, 19, 26, 18, 34, 17, 35, 14, 36, 13, 37, 12, 3, 31)
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 ') AND cat_id IN (0, 1, 16, 33, 2, 9, 29, 4, 6, 28, 7, 27, 19, 26, 18, 34, 17, 35' at line 3
Is it normal that i have to be in the thumbnails view to get the button working because there it works.
Where to place download_button that it only shown in subcategories?
Greetz X23
-
Thnx V@no this MOD is working for me now, the generated zip file name is numeric (random numbers "12387653.zip") is it possible to make zip file name as category name? i.e my_cat_name.zip.
-
Thnx V@no this MOD is working for me now, the generated zip file name is numeric (random numbers "12387653.zip") is it possible to make zip file name as category name? i.e my_cat_name.zip.
Hi,
thats the line that defines the name (download.php):
$file['file_name'] = time().".zip";
you should change:
time().
to what ever i think... im not sure but maybe V@no clears that up ;)
Iam also not sure if $cat_name is working in download.php...
EDIT:
It seems that iam wrong with that, i've tried:
time()."pups.zip"
But the filename is allready only the timestamp... hmmm V@no help please :)
Greetz X23
-
@x23piracy:
that is the correct line and it should work...
Try replace that line with:
$file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
-
Hi,
thnx for your help works fine for me now just want v@no to review the code if it is ok.
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
$file['file_data'] = $zipfile->send($cat_cache[$cat_id]['cat_name'].".zip");
$file['file_size'] = strlen($file['file_data']);
}
-
Hi,
thnx for your help works fine for me now just want v@no to review the code if it is ok.
if ($file_added) {
@set_time_limit(120);
$file['file_name'] = $cat_cache[$cat_id]['cat_name'].".zip";
$file['file_data'] = $zipfile->send($cat_cache[$cat_id]['cat_name'].".zip");
$file['file_size'] = strlen($file['file_data']);
}
Hi,
it's working you can try that without any risk ;)
Greetz X23
-
thnx @ x23piracy
-
Hi,
MOD is working perfect but on few categories which has more images i get this error
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 11373269 bytes) in /home/xxx/public_html/includes/zip.php on line 85
-
Hi,
MOD is working perfect but on few categories which has more images i get this error
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 11373269 bytes) in /home/xxx/public_html/includes/zip.php on line 85
Hi,
the server needs a big amount of memory if there are much images to build a archiv from.
About how much pictures with what size we are talking about?
Greetz X23
-
Hi X23,
well the category i am facing this error has 83 pictures, 33+ MB of size.
Best Wishes
-
Hi X23,
well the category i am facing this error has 83 pictures, 33+ MB of size.
Best Wishes
Hi,
try to increase your php memory limit to 48MB, 64MB or more.
Allowed memory size of 33554432 (bytes) / 1024000 (bytes = 1MB) = 32,768 MB
tried to allocate 11373269 / 1024000 = 11,107 MB needed additional memory in that case
You have to do this on your server, edit php.ini:
(XX for the number of MB 8,16,24,32,48,64...)
memory_limit = XXM
restart usually apache...
if your server is confixx based login as admin and goto:
settings > httpd special and set it up
if you have no root access ask your provider.
Do you have compression enabled? maybe it's just an idea, try to turn it off and see what happens.
If all that fails limitate the pictures per page and use this mod for downloading visible page images only.
(just a workaround, first case is to get more memory available)
Greetz X23
-
Hallo,
habe diesen Mod geändert, so daß der "big"- bzw. Downloadordner verwendet wird, sofern die Datei vorhanden. Dazu ist zu ändern:
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
$file_name = $image_row['image_media_file'];
zu ersetzen mit:
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/download/".$image_row['image_media_file'];
if(!file_exists($file_path)){
$file_path = MEDIA_PATH."/".$image_row['cat_id']."/".$image_row['image_media_file'];
}
$file_name = $image_row['image_media_file'];
wobei download mit dem verwendeten Ordner übereinstimmen muß (i.d.R. "big").
Ergänzung:
Wer den MOD zur Sortierung der Images je Kategorie (http://www.4homepages.de/forum/index.php?topic=5026.msg21254#msg21254) verwendet, muß
ORDER BY ".$cat_cache[$cat_id]['sort_field']." ".$cat_cache[$cat_id]['sort_order'].", i.image_id ".$config['image_sort']."
Verwenden.
MOD funzt mit 1.7.9 unter Beachtung der Änderung $file['file_data'] = $zipfile->send(time().".zip");
perfekt!
Viele Grüße,
Henry