Imagepng gd png error compression level must be 0 through 9

Image Compression Error (.png) #446 Comments I was trying to upload a .png image, then I got the following error: imagepng(): gd-png error: compression level must be 0 through 9 This problem happened trying to upload a .png file. The text was updated successfully, but these errors were encountered: We need more information . […]

Содержание

  1. Image Compression Error (.png) #446
  2. Comments
  3. Take a look at these screenshots:
  4. Choosing the media type:
  5. Selecting the media file to upload:
  6. Creating the new media:
  7. The error displayed in production environment:
  8. The error displayed in development environment:
  9. Сбой PHP Image Magician при загрузке нескольких больших изображений
  10. 1 ответ
  11. Ошибка PHP Image Magician при загрузке нескольких больших изображений
  12. 1 ответ
  13. image output: throw ValueError on out-of-bounds qualities about php-src HOT 3 OPEN
  14. Comments (3)
  15. Related Issues (20)
  16. Recommend Projects
  17. React
  18. Vue.js
  19. Typescript
  20. TensorFlow
  21. Django
  22. Laravel
  23. Recommend Topics
  24. javascript
  25. server
  26. Machine learning
  27. Visualization
  28. Recommend Org
  29. Facebook
  30. Microsoft
  31. imagepng compression level must be 0 through 9 about php-image HOT 2 CLOSED
  32. Comments (2)
  33. Related Issues (20)
  34. Recommend Projects
  35. React
  36. Vue.js
  37. Typescript
  38. TensorFlow
  39. Django
  40. Laravel
  41. Recommend Topics
  42. javascript
  43. server
  44. Machine learning
  45. Visualization
  46. Recommend Org
  47. Facebook
  48. Microsoft

Image Compression Error (.png) #446

I was trying to upload a .png image, then I got the following error:

imagepng(): gd-png error: compression level must be 0 through 9

This problem happened trying to upload a .png file.

The text was updated successfully, but these errors were encountered:

We need more information .

I just upgraded all the versions of sonata bundles I use, I am currently using the stable versions. From the admin, I was uploading a .png picture and I got that error. It did not happend with the previous versions I used. I recently noticed if you try to upload a .gif picture, you get the 500 internal server error.

Take a look at these screenshots:

Choosing the media type:

Selecting the media file to upload:

Creating the new media:

The error displayed in production environment:

The error displayed in development environment:

Did someone of you guys get this error in the testing process?

A PNG screenshot works here . can you post an url with your unsupported png file ?

I’m currently working in a project with all the sonata stable bundles, I’ve tested the sandbox project (2.3-develop) and then I found another one bug at uploading a media file (picture).

In my project I try to upload the picture you show me above, and there’s no way to make it work, however I didn’t have any bug with all the .jpg and .jpeg files I uploaded.

How did you get upload a .png picture successfully?

I’ve been trying to find the problem into SonataMediaBundle source but I couldn’t find where is the problem!

Источник

Сбой PHP Image Magician при загрузке нескольких больших изображений

Я использую PHP Image Magician для создания эскизов и многоразовой формы для изображений. Когда я пытаюсь загрузить 10 изображений размером

30 кбайт каждый, они загружаются, но если я попытаюсь загрузить 2 изображения размером

6-7mb каждый, это сохранит только первое изображение в папке и базе данных и сбое страницы. Не сохранял ничего в папке большого пальца.

Если я попытаюсь использовать только одно изображение, оно сохраняется в обеих папках (обычный + большой) и в базе данных. Нет никаких проблем.

Я также увеличил число php.ini

В чем может быть проблема. В случае необходимости я могу опубликовать также источник.

1 ответ

Может быть, ваше значение upload_max_filesize ?

Попробуйте то же самое для post_max_size

Я никогда не использую чистые значения чисел, просто число и букву М.

Другие возможные решения:

  • Я проверяю ваш код и не $emsg переменные $smsg и $emsg , оба не определены.
  • Отлаживайте свой код с помощью расширений xdebug или вручную (используя var_dump/echo с любой переменной, а затем выйдите для проверки, работают ли какие-либо условия, как вы хотите)

PHP Magician lib

Я тестирую эту библиотеку, и когда я пытаюсь загрузить 3 jpegs и 2 png, я получаю следующие ошибки:

Затем я проверяю код и обнаружил одну ошибку: в моем случае значение png установлено на -36, и правильно должно быть только от 0 до 9.

Источник

Ошибка PHP Image Magician при загрузке нескольких больших изображений

Я использую PHP Image Magician для создания миниатюр и форм для нескольких загрузок изображений. Когда я пытаюсь загрузить 10 изображений размером

30 КБ каждое, они загружаются, но если я попытаюсь загрузить 2 изображения размером

6-7 МБ каждое, он сохранит только первое изображение в папку и базу данных и произойдет сбой страницы. В папку большого пальца ничего не сохранял.

Если я попробую использовать только одно изображение, оно будет сохранено в обеих папках (обычный + большой палец) и в базе данных. Вообще нет никаких проблем.

Я также увеличил в php.ini

В чем может быть проблема. Если нужно, я могу разместить также какой-нибудь источник.

1 ответ

Может быть, ваша ценность upload_max_filesize ?

Upload_max_filesize = 100 МБ

Попробуйте то же самое для post_max_size

Upload_max_filesize = 100 МБ

Я никогда не использую чистые числовые значения , только число и букву M .

Другие возможные решения:

  • Я проверил ваш код и не нашел переменных $smsg и $emsg , обе не определены.
  • Отлаживайте свой код с помощью расширений xdebug или вручную (используя var_dump / echo с любой переменной, а затем выйдите, чтобы проверить, работает ли какое-либо условие, как вы хотите)

Библиотека PHP Magician

Я тестирую эту библиотеку, и когда я пытаюсь загрузить 3 jpeg и 2 png, я получаю следующие ошибки:

Затем я проверяю код и обнаруживаю одну ошибку: качество png в моем случае установлено на -36, а правильное значение должно быть только между 0 и 9.

Источник

image output: throw ValueError on out-of-bounds qualities about php-src HOT 3 OPEN

The $quality must be in range 0 to 9. If you pass 98, you get a warning: «imagepng(): gd-png error: compression level must be 0 through 9», and the function returs false, which is converted to an empty string.

steffdimitrov commented on January 15, 2023

Yes, I saw that my warnings/notices were turned off. But still, IMO passing data outside wanted range must be an error. Also, imagejpeg wants number between 0 and 100, imagepng wants number between 0 and 9, imagegif doesn’t have quality parameter.

cmb69 commented on January 15, 2023

It might make sense to throw a ValueError for out-of-bounds qualitites, but for BC reasons, that would have to wait until PHP 9, and might require an RFC.

  • Incorrect arithmetic calculations when using JIT (2) HOT 4
  • Latest intl and icu versions cause «breaking change» with Canadian currency display HOT 1
  • DateTimeZone Doesn’t Handle Etc/GMT+10 in Php8.1.14 and Php8.2.1 HOT 1
  • new DateTimeZone(‘Etc/GMT+9’) fails with fatal error since 8.1.14 HOT 1
  • DateTimeZone::listIdentifiers returns a timezone Etc/GMT+0 which can not be used by DateTimeZone constructor HOT 4
  • IntlDateFormatter fails to format with pattern «QQQQQ» HOT 5
  • DateTime::setTimezone produce different results with 7.4 and 8.0 HOT 3
  • Number columns are being converted to strings when using oci8 HOT 1
  • srand(0) set random seed to 0 instead random HOT 14
  • ext-soap throws uncatchable errors HOT 2
  • Unknown or bad timezone (Etc/GMT+12) HOT 2
  • new strip_comments($language, $code) function HOT 1
  • xxh3 hash ignores seed if string? HOT 5
  • token_get_all() invalid behavior with readonly and DNF tokens HOT 10
  • Segfault in Zend/zend_objects_API.c:zend_objects_store_free_object_storage HOT 2
  • PDO_DBLIB encodes passed binary data as a string, which is fragile HOT 2
  • FPM health check
  • FPM unknown child alert not valid HOT 1
  • FPM support for S6 service startup notifications
  • XSLTProcessor::transformToXml() doesn’t need null return type HOT 1

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

imagepng compression level must be 0 through 9 about php-image HOT 2 CLOSED

this can be fixed with using $image->checkQuality() at first

kus commented on January 15, 2023

I’ve updated the library so it will automatically check the quality is correct and set it to a sensible value if it is incorrect.

  • setResource dimesion error HOT 1
  • checkQuality() bug HOT 1
  • Alignment ignored is font scaling is not required. HOT 1
  • Font Letter Spacing and Line Height HOT 1
  • Can’t really center text HOT 10
  • Can’t Change the bg color of $image->text(..) function HOT 1
  • Increase width. HOT 1
  • StrokeWidth / StrokeColor not working in array. HOT 2
  • Multiline Text Alignment doesn’t work HOT 2
  • I hava a question. HOT 1
  • Image Text adjusting issues HOT 1
  • My text starts from bottom and ends to top HOT 3
  • Center text vertically in a box. HOT 1
  • other ways to add to the image HOT 1
  • Line height problem with diacritic symbols HOT 3
  • Black background when rotate image
  • How can i save image with custom name before display it? HOT 1
  • How to change image background with transparent color? HOT 1
  • How to get overlay image from upload form

Recommend Projects

React

A declarative, efficient, and flexible JavaScript library for building user interfaces.

Vue.js

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Typescript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

TensorFlow

An Open Source Machine Learning Framework for Everyone

Django

The Web framework for perfectionists with deadlines.

Laravel

A PHP framework for web artisans

Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

javascript

JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

Some thing interesting about web. New door for the world.

server

A server is a program made to process requests and deliver data to clients.

Machine learning

Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

Visualization

Some thing interesting about visualization, use data art

Some thing interesting about game, make everyone happy.

Recommend Org

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Microsoft

Open source projects and samples from Microsoft.

Источник

За последние 24 часа нас посетили 11528 программистов и 1148 роботов. Сейчас ищут 175 программистов …


  1. Great_DUKE

    С нами с:
    2 ноя 2015
    Сообщения:
    106
    Симпатии:
    0

    Здравствуйте! Для изменения размеров изображения пользуюсь данной функцией

    1. function SetImgSize($img, $width, $height, $AspectRatio, $filePut)
    2. if(($width < $srcWidth) || ($height > $srcHeight))
    3.     $ratioWidth = $srcWidth/$width;
    4.     $ratioHeight = $srcHeight/$height;
    5.     if($ratioWidth < $ratioHeight)
    6.     $destWidth = intval($srcWidth/$ratioHeight);
    7.     $destHeight = intval($srcHeight/$ratioWidth);
    8.     ImageCopyResampled($resImage, $srcImage, 0, 0, 0, 0, $destWidth, $destHeight, $srcWidth, $srcHeight);
    9.         ImageJPEG($resImage, $filePut, 90);// 100 — максимальное качество

    Работает хорошо, за исключение того, что в ней есть один баг, ну или недоработка.
    Пользуюсь данной функцией в цикле, аргумент $img может принимать и jpg изображения и png и gif.
    Если скажем так, изменить размер только одного изображения и формата png (ну или jpg, gif), то все работает корректно, но а если изменить размер jpg изображения, а потом png, то png изображение не сохранится, а все последующие изображения НЕ формата png — сохранятся. В чем проблема, не могу понять.


  2. mahmuzar

    @Great_DUKE, не дави ошибки, может узнаешь в чем дело?
    Отладку как делаешь:?
    — Добавлено —

    вероятнее всего ошибка во втором switch


  3. Great_DUKE

    С нами с:
    2 ноя 2015
    Сообщения:
    106
    Симпатии:
    0

    Забавно, но нет. Даже если на месте функции будет

    , то этот баг будет все равно появляться.
    ImageJPEG я сделал просто для теста.


  4. Silver Soft

    Silver Soft
    Активный пользователь

    С нами с:
    5 авг 2011
    Сообщения:
    17
    Симпатии:
    1

    я думаю, понятноне 90, а 9


  1. Home


  2. Software Programming


  3. Png imaging load

This topic has been deleted. Only users with topic management privileges can see it.


  • There’s a problem in downloading png images, other formats are fine. Makes such a mistake:

    Warning: imagepng()
    [function.imagepng]: gd-png error:
    compression level must be 0 through 9


  • Is it possible that the last argument in calling imagepng() is misleading? It should be between 0 and 9.

    PS. Send the code.


Suggested Topics

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

  • 2

    0
    Votes

    2
    Posts

    0
    Views

Понравилась статья? Поделить с друзьями:
  • Image updated failed error in creating file
  • Ikernel exe 0x800 ошибка при установке
  • Image type x64 is not supported by this ia32 shell как исправить
  • Image save error
  • Ike peer reported error перевод