4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 24, 2014, 08:41:41 PM

Login with username, password and session length
Search:     Advanced search
You're looking for some 4images templates and styles? Then visit this thread to show websites with 4images templates to download.
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Help / Hilfe
| |-+  Bug Fixes & Patches
| | |-+  [1.7 / 1.7.1] PHP v5.1.x and PNG images error
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: [1.7 / 1.7.1] PHP v5.1.x and PNG images error  (Read 22378 times)
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 549

mmm PHP...


View Profile WWW
« on: February 25, 2006, 10:26:48 AM »

Since PHP v5.1 the GD function imagepng() accepts compression argument. The compression argument must be from 0 to 9. 4images is using the compression settings when creating thumbnails or image resizing for jpeg images which can be from 0 to 100. Because of that using imagepng() function will return fatal error
Quote  [Expand]
PHP Fatal error: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: gd-png: fatal libpng error: zlib error in example.php on line 10

The fix is simple:
In includes/image_utils.php find:
1
    $image_handle = "image".$types[$image_info[2]];

Insert below:
1
    if ($image_info[2] == 3) $quality = 9;
Logged

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)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 156
-Receive: 75

Neverdie


View Profile
« Reply #1 on: March 16, 2010, 10:00:51 PM »

Member Upload work with png fix
ACP Upload dont work with png fix

Image file uploaded: bioshock2_details.png
Error while uploading the thumbnail image: bioshock2_thumbnail.png
bioshock2_details.png: The file has an invalid format (png, image / png)

Image file deleted
Data not written to the database

----

Bild-Datei erfolgreich upgeloadet: bioshock2_details.png
Fehler beim Upload der Thumbnail-Bilddatei: bioshock2_thumbnail.png
bioshock2_details.png: Die Datei hat ein ungültiges Format (png, image/png)

Bild-Datei wieder gelöscht
Daten nicht in die Datenbank geschrieben

Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 549

mmm PHP...


View Profile WWW
« Reply #2 on: March 17, 2010, 12:35:47 AM »

FAQ -> How can I add more allowed file extensions?
Logged

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)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 156
-Receive: 75

Neverdie


View Profile
« Reply #3 on: March 17, 2010, 12:43:55 AM »

Yes i have. But dont work.....
And is a fresh with little modifikation 4images installation
Png is an allowed file extensions!

* 17.03.png (17.32 KB - downloaded 3 times.)
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 549

mmm PHP...


View Profile WWW
« Reply #4 on: March 17, 2010, 01:44:23 AM »

and you have image/png  MIME type?
Logged

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)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 156
-Receive: 75

Neverdie


View Profile
« Reply #5 on: March 17, 2010, 01:58:11 AM »

Yes MIME
(image/png image/x-png)
Template:
1
2
<!-- Template file for PNG Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} /><br />
upload_definitions.php
1
$mime_type_match['png'] = array("image/png""image/x-png");
Full
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: upload_definitions.php                               *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.6                                                *
 *                                                                        *
 *    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.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die(
"Security violation");
}
//AUTOMATICALLY GENERATED BY MIME.PHP PLUGIN

$mime_type_match['ai'] = array("application/postscript");
$mime_type_match['aif'] = array("audio/x-aiff");
$mime_type_match['aiff'] = array("audio/x-aiff");
$mime_type_match['au'] = array("audio/basic");
$mime_type_match['avi'] = array("video/x-msvideo""video/avi");
$mime_type_match['bmp'] = array("image/bmp""image/x-ms-bmp");
$mime_type_match['css'] = array("text/css");
$mime_type_match['csv'] = array("text/comma-separated-values");
$mime_type_match['doc'] = array("application/msword");
$mime_type_match['eps'] = array("application/postscript");
$mime_type_match['fla'] = array("application/octet-stream");
$mime_type_match['gif'] = array("image/gif");
$mime_type_match['gtar'] = array("application/x-gtar");
$mime_type_match['gz'] = array("application/gzip""application/x-gzip-compressed");
$mime_type_match['jpeg'] = array("image/jpg""image/jpeg""image/pjpeg");
$mime_type_match['jpg'] = array("image/jpg""image/jpeg""image/pjpeg");
$mime_type_match['js'] = array("text/javascript");
$mime_type_match['mid'] = array("audio/x-midi""audio/mid""audio/midi");
$mime_type_match['mov'] = array("video/quicktime");
$mime_type_match['mp3'] = array("audio/mpeg""audio/x-mpeg""audio/mp3""audio/mpg");
$mime_type_match['mpe'] = array("video/mpeg");
$mime_type_match['mpeg'] = array("video/mpeg");
$mime_type_match['mpg'] = array("video/mpeg");
$mime_type_match['pdf'] = array("application/pdf""application/x-pdf");
$mime_type_match['png'] = array("image/png""image/x-png");
$mime_type_match['ppt'] = array("application/vnd");
$mime_type_match['ps'] = array("application/postscript");
$mime_type_match['psd'] = array("application/octet-stream");
$mime_type_match['qt'] = array("video/quicktime");
$mime_type_match['ra'] = array("audio/x-pn-realaudio");
$mime_type_match['ram'] = array("audio/x-pn-realaudio");
$mime_type_match['rar'] = array("application/x-rar-compressed");
$mime_type_match['rm'] = array("audio/vnd.rn-realmedia""application/vnd.rn-realmedia""video/vnd.rn-realvideo""application/vnd");
$mime_type_match['rpm'] = array("audio/x-pn-realaudio-plugin");
$mime_type_match['rtf'] = array("text/plain""text/richtext""text/rtf");
$mime_type_match['rtx'] = array("text/plain""text/richtext""text/rtf");
$mime_type_match['sit'] = array("application/x-stuffit");
$mime_type_match['snd'] = array("audio/basic");
$mime_type_match['swf'] = array("application/x-shockwave-flash");
$mime_type_match['tar'] = array("application/x-tar");
$mime_type_match['tif'] = array("image/tiff""application/octet-stream");
$mime_type_match['tiff'] = array("image/tiff""application/octet-stream");
$mime_type_match['txt'] = array("text/plain""text/richtext""text/rtf""text/html");
$mime_type_match['wav'] = array("audio/x-wav");
$mime_type_match['xls'] = array("application/vnd""application/x-msexcel");
$mime_type_match['zip'] = array("application/zip""application/x-zip-compressed");
?>
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 549

mmm PHP...


View Profile WWW
« Reply #6 on: March 17, 2010, 02:27:02 AM »

Oh, that comes from thumbnail, which apparently doesn't use same list of MIME type as images...

Try this, in includes/upload.php find: (wrong!)
1
    $this->accepted_extensions['media'] = $config['allowed_mediatypes_array'];

Insert below:
1
    $this->accepted_extensions['thumb'] = $config['allowed_mediatypes_array'];
« Last Edit: March 18, 2010, 12:51:14 AM by V@no » Logged

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)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 156
-Receive: 75

Neverdie


View Profile
« Reply #7 on: March 17, 2010, 08:08:03 AM »

Dont work, in Admin Panel comes:

Quote  [Expand]
Image file uploaded: bioshock2_details.png
Error while uploading the thumbnail image: bioshock2_thumbnail.png
bioshock2_details.png: The file has an invalid format (png, image / png)

Image file deleted
Data not written to the database

Please Help me!
« Last Edit: March 17, 2010, 09:10:55 PM by Sumale.nin » Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 549

mmm PHP...


View Profile WWW
« Reply #8 on: March 18, 2010, 12:50:02 AM »

My apology, my suggestion above was absolutely wrong...

In includes/upload.php find:
1
    foreach ($mime_type_match as $key => $val) {

Insert below:
1
2
3
4
5
6
7
8
9
10
      if (in_array($key$this->accepted_extensions['thumb'])) {
        if (
is_array($val)) {
          foreach (
$val as $key2 => $val2) {
            
$this->accepted_mime_types['thumb'][] = $val2;
          }
        }
        else {
          
$this->accepted_mime_types['thumb'][] = $val;
        }
      }
Logged

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)
Sumale.my
Addicted member
******
Offline Offline

Posts: 1785

Thank You
-Given: 156
-Receive: 75

Neverdie


View Profile
« Reply #9 on: March 18, 2010, 10:58:10 AM »

WORKS VERY FINE!
Please write this fix in your first Post!

Thank you V@no, you are my Hero Razz

LG
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
piqs.de - Fotocommunity & lizenzfreie Fotos
Page created in 0.23 seconds with 19 queries.
Post your comments here