Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

KissIT Image Thumbnailer Support


raiwa

Recommended Posts

What's the best way to deal with this error?

Fatal error: Uncaught ValueError: imagecolorsforindex(): Argument #2 ($color) is out of range

PHP 8 has changed the behavior of the shutup operator - it no longer silences fatal errors.

 

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Link to comment
Share on other sites

On 10/5/2021 at 12:52 AM, Smoky Barnable said:

What's the best way to deal with this error?

Fatal error: Uncaught ValueError: imagecolorsforindex(): Argument #2 ($color) is out of range

PHP 8 has changed the behavior of the shutup operator - it no longer silences fatal errors.

 

For those of you who would like to use this addon with PHP 8 the following change cleared this fatal error.

In the image.php file, change:

$trnprt_color = @imagecolorsforindex ( $this->_image, $trnprt_indx );

to:

if ($trnprt_indx < imagecolorstotal($this->_image)){
        		   $trnprt_color = imagecolorsforindex ( $this->_image, $trnprt_indx );
				  }

 

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Link to comment
Share on other sites

On 9/27/2021 at 1:43 AM, Smoky Barnable said:

I have this mostly working with PHP8 except for this warning:

Deprecated: Required parameter $quality follows optional parameter $save_in in /home/includes/modules/kiss_image_thumbnailer/classes/Image.php on line 137


    protected function _output( $save_in = null, $quality, $filters = null ) {
      switch ($this->_mime_type) {
        case self::IMAGETYPE_GIF :
          return imagegif ( $this->_image, $save_in );
          break;
        case self::IMAGETYPE_JPEG :
        case self::IMAGETYPE_JPG :
          $quality = is_null ( $quality ) ? 75 : $quality;
          return imagejpeg ( $this->_image, $save_in, $quality );
          break;
        case self::IMAGETYPE_PNG :
          $quality = 9;
          $filters = is_null ( $filters ) ? null : $filters;
          return imagepng ( $this->_image, $save_in, $quality, $filters );
          break;
        default :
          trigger_error ( 'Image cannot be created.', E_USER_NOTICE );
          break;
      } // end switch
    } // end method

I see this warning in the "what's new?" box.

    protected function _output( $quality, $save_in = null, $filters = null ) {
      switch ($this->_mime_type) {
        case self::IMAGETYPE_GIF :
          return imagegif ( $this->_image, $save_in );
          break;
        case self::IMAGETYPE_JPEG :
        case self::IMAGETYPE_JPG :
          $quality = is_null ( $quality ) ? 75 : $quality;
          return imagejpeg ( $this->_image, $quality, $save_in );
          break;
        case self::IMAGETYPE_PNG :
          $quality = is_null ( $quality ) ? 0 : $quality;
          $filters = is_null ( $filters ) ? null : $filters;
          return imagepng ( $this->_image, $quality, $save_in, $filters );
          break;
        default :
          trigger_error ( 'Image cannot be created.', E_USER_NOTICE );
          break;

This works for me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...