4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Alain on June 17, 2002, 03:44:11 PM

Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Alain on June 17, 2002, 03:44:11 PM
Hi, I've activated GZIP feature in the admin. panel and activated in the PHP.INI the php_zlib.dll module and also installed the Apache GZIP dll module but still the Download ZIP button doesn't appear beside the Download button...? Why?

Also the download button works (save as) but if you choose OPEN FROM THE LOCATION and do not want to save it but open it in your browser directly then it is waiting, waiting... and the Apache web server is then unable to load any picture if I come back to my site. As if the connection couldn't be closed...
If no workaround is possible, how to force the user to download the picture and not ask to open from the location?

Thanks!

 8)
Title: Applied
Post by: Alain on June 17, 2002, 08:47:38 PM
I applied pre-solution http://www.4homepages.de/forum/viewtopic.php?t=606 but this button doesn't want to show up.

 :oops:
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Jan on June 17, 2002, 09:26:50 PM
Try this:

includes/functions.php
change:
Code: [Select]
$target = (get_cfg_var("safe_mode") == 1 || (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url']))) ? "target=\"_blank\"" : "";
to:
Code: [Select]
$target = (!empty($image_row['image_download_url']) && !is_remote_file($image_row['image_download_url'])) ? "target=\"_blank\"" : "";


lightbox.php
change:
Code: [Select]
if (get_cfg_var("safe_mode") == 0 && function_exists("gzcompress") && function_exists("crc32")) {
to:
Code: [Select]
if (function_exists("gzcompress") && function_exists("crc32")) {


download.php
change:
Code: [Select]
if (empty($user_info['lightbox_image_ids']) || get_cfg_var("safe_mode") == 1 || !function_exists("gzcompress") || !function_exists("crc32")) {
to:
Code: [Select]
if (empty($user_info['lightbox_image_ids']) || !function_exists("gzcompress") || !function_exists("crc32")) {

and change:
Code: [Select]
if (get_cfg_var("safe_mode") == 1 || $remote_url) {
to:
Code: [Select]
if ($remote_url) {

Greets Jan
Title: Nothing
Post by: Alain on June 17, 2002, 10:08:49 PM
Still nothing, is there a way to check if my config. is OK for this feature?
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Nicky on June 17, 2002, 11:19:15 PM
hi,

i installed today on my win2000 PC:
apache 1.3.24 (from apache.org)
php 4.2.1 (from php.net) (running as CGI binary)
mysql 3.23.51 (from mysql.com)

AND everything working fine for me...
zlib, download from own server, download from remote server, zipping...
ImageMagick, GD, auto resizer, auto thumbnailer...
Title: EasyPHP
Post by: Alain on June 17, 2002, 11:22:27 PM
This isn't EasyPHP package  :lol:
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Nicky on June 17, 2002, 11:30:27 PM
Alain,

come on...

maybe have "EasyPHP package" some bugs ;)
Title: OK
Post by: Alain on June 17, 2002, 11:47:03 PM
I'll try to get rid of this french s***  :twisted:
Title: GZIP
Post by: Alain on June 18, 2002, 12:55:36 AM
Could you give a step-by-step instruction to install this GZIP support with Apache/PHP?
I've totally switched to the normal Apache/PHP/MySQL system but this button will never show up!!!

 :evil:
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Nicky on June 18, 2002, 01:15:35 AM
hi,

open your PHP.INI and change:

Code: [Select]

;extension=php_zlib.dll

to
Code: [Select]

extension=php_zlib.dll


if you get an error:
change
Code: [Select]

extension_dir = ./

to
Code: [Select]

extension_dir = ./extensions
Title: Forced download
Post by: Alain on June 18, 2002, 01:16:09 AM
I managed to force the download of the picture otherwise if you choose 'Open from location' then it was bugging my web server.



$dlext = ".pix";

if (!empty($file['file_data'])) {
  if (eregi("MSIE", getenv("HTTP_USER_AGENT"))) {
    $disposition = ($action != "zip" && $action != "lightbox") ? 'attachment' : 'inline';
    header("Content-Disposition: $disposition; filename=".$file['file_name']."$dlext\n");
    header("Content-Type: application/x-ms-download\n");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Pragma: public");
  }
  elseif (eregi("Opera", getenv("HTTP_USER_AGENT"))) {
    header("Content-Disposition: attachment; filename=".$file['file_name']."$dlext\n");
    header("Content-Type: application/octetstream\n");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
  }
  else {
    header("Content-Disposition: attachment; filename=".$file['file_name']."$dlext\n");
    header("Content-Type: application/octet-stream\n");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");
  }
  header("Last Modified: ".gmdate("D, d M Y H:i:s")."GMT\n");
  header("Expires: 0\n");
  header("Content-Length: ".$file['file_size']."\n");

  if (eregi("Mac", getenv("HTTP_USER_AGENT"))) {
    header("Content-Transfer-Encoding: binary\n");
    header("Accept-Ranges: bytes\n");
    header("Connection: close\n");
  }
  echo $file['file_data'];
}


The extension .pix is added to make it viewable only if already downloaded  :o


[/i]
Title: Cool!
Post by: Alain on June 18, 2002, 01:30:02 AM
It works now, I thought I shouldn't use the full path to the PHP/ZLIB extension. The lightbox ZIP download is xtra!

I still have this problem when you choose 'Open from location' with a picture, it is waiting, waiting... and then nothing appears... The web server is not usable anymore and I have to close the Windows session to make it usable again...  :oops:
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Nicky on June 18, 2002, 03:05:22 AM
hi,

i'm not sure what you mean with "'Open from location'" but maybe this will help

admin/constants.php

// Check existence of remote image files.
// If you choose 1, you could get sometimes timeout errors
define('CHECK_REMOTE_FILES', 1);
Title: GZIP/ZLIB + OPEN FROM LOCATION (DOWNLOAD BUTTON)
Post by: Jan on June 18, 2002, 07:22:52 AM
Which browser are you using? I tried it with IE 6, Opera 6.01, Mozilla 1.0 RC2, it works well. Only Netscapes (4.7 and 6) want to save the file with the name "download.php", but if you rename it to download.jpg it works ;)

Greets Jan