[photos] Problem with downloading images by a user #312

Closed
opened 2026-10-04 23:51:42 +02:00 by adam · 1 comment
Owner

Reported by povpiwigo on 22 Mar 2011 08:15

Version: 2.1.4

Hi
I have a problem with the downloading of images by the user. As the user clicks on the icon for downloading an image, the images comes in the navigator as text. I debug the PHP and find the source of the problem. It is the line 148 in the file “action.php” which contains “$ctype = mime_content_type($file);”. I tried to comment the line and everything works correctly.
I read in the documentation of PHP, that the function is deprecated. This documentation says that now it better to use the extension PECL Fileinfo.
I hope that this bug report can help you.
Just a thing before closing: piwigo is fantastic
Sincerely you
Pierre-Olivier

Piwigo Bugtracker #2227

**Reported by povpiwigo on 22 Mar 2011 08:15** **Version:** 2.1.4 Hi I have a problem with the downloading of images by the user. As the user clicks on the icon for downloading an image, the images comes in the navigator as text. I debug the PHP and find the source of the problem. It is the line 148 in the file “action.php” which contains “$ctype = mime_content_type($file);”. I tried to comment the line and everything works correctly. I read in the documentation of PHP, that the function is deprecated. This documentation says that now it better to use the extension PECL Fileinfo. I hope that this bug report can help you. Just a thing before closing: piwigo is fantastic Sincerely you Pierre-Olivier [Piwigo Bugtracker #2227](http://piwigo.org/bugs/view.php?id=2227) <!-- github-sync-id:97252271 -->
adam closed this issue 2026-10-04 23:51:43 +02:00
Author
Owner

I think the problem is solved in Piwigo 2.8 (and certainly earlier), because we do something like

$ctype = null;
if (!url_is_remote($file))
{
  if ( function_exists('mime_content_type') )
  {
    $ctype = mime_content_type($file);
  }
...
if (!isset($ctype))
{ // give it a guess
  $ctype = guess_mime_type( get_extension($file) );
}

$http_headers[] = 'Content-Type: '.$ctype;
I think the problem is solved in Piwigo 2.8 (and certainly earlier), because we do something like ``` $ctype = null; if (!url_is_remote($file)) { if ( function_exists('mime_content_type') ) { $ctype = mime_content_type($file); } ... if (!isset($ctype)) { // give it a guess $ctype = guess_mime_type( get_extension($file) ); } $http_headers[] = 'Content-Type: '.$ctype; ``` <!-- github-comment-id:231603406 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#312