$color is out of range Topic is solved
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Apprentice
- Posts: 49
- Joined: Wed Jun 01, 2022 9:44 pm
$color is out of range
This is one I couldn't find any posts on: imagecolorsforindex(): Argument #2 ($color) is out of range
How does one go about finding where this error occurs?
It prevents me from choosing any image to load.
Please help
How does one go about finding where this error occurs?
It prevents me from choosing any image to load.
Please help
- AMurray
- Joomla! Exemplar
- Posts: 9739
- Joined: Sat Feb 13, 2010 7:35 am
- Location: Australia
Re: $color is out of range
Don't think this is a Joomla issue - it's a PHP error.
https://www.php.net/manual/en/function. ... rindex.php
Perhaps some PHP guru can explain the techno-babble. .
https://www.php.net/manual/en/function. ... rindex.php
Perhaps some PHP guru can explain the techno-babble. .
Regards - A Murray
General Support Moderator
General Support Moderator
- toivo
- Joomla! Master
- Posts: 17439
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: $color is out of range
Joomla 4.3 refers to the native PHP function imagecolorsforindex() twice, both times when processing images with transparency. The calls are in the functions Image::crop() and Image::resize() in libraries/src/Image/Image.php.
Those two functions are called from several Joomla core routines and probably also third party extensions, using the GD library.
Which version of PHP does this site use? This question is relevant because function imagecolorsforindex() changed slightly in PHP 8.
How did you create the images you are trying to load?
Change the Global Configuration so that the error messages identify the script and display also the PHP call stack so that it is possible to see the sequence of function calls:
Those two functions are called from several Joomla core routines and probably also third party extensions, using the GD library.
Which version of PHP does this site use? This question is relevant because function imagecolorsforindex() changed slightly in PHP 8.
How did you create the images you are trying to load?
Change the Global Configuration so that the error messages identify the script and display also the PHP call stack so that it is possible to see the sequence of function calls:
- Debug System: Yes
- Error Reporting: Maximum
- Log Almost Everything: Yes
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 49
- Joined: Wed Jun 01, 2022 9:44 pm
Re: $color is out of range
Thanks Toivo. That error only happened when I turned on thumbnails in Filesystem Group>Local. I turned it off after and the error cleared. Turned it back on this morning to recreate the error, but it didn't show. I' keep trying and send you the data. I am on Joomla ver. 4.3.1, and php 8.1.17. I'll post again if I see the error again.
-
- Joomla! Apprentice
- Posts: 49
- Joined: Wed Jun 01, 2022 9:44 pm
Re: $color is out of range
Thanks again Toivo & AMurray
I am not fluent in php but the attached are what I think you want
I am not fluent in php but the attached are what I think you want
You do not have the required permissions to view the files attached to this post.
- toivo
- Joomla! Master
- Posts: 17439
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: $color is out of range
It is not clear what triggers the PHP error 'Page not found'.
The other error comes from the following PHP code in libraries/src/Image/Image.php, line 716:
The second argument of the function imagecolorsforindex() above is the value returned by the function imagecolortransparent(), which in this case returns an invalid value of the transparent colour.
Ref. PHP: imagecolortransparent
Key Questions
Q2: How were those images created, meaning which software application created them?
Additional Checks
Go to System - Information - System Information and click the tab PHP Information. Search for 'gd' on the page or locate 'fileinfo' and 'filter', under which you should see the heading 'gd'.
Is the library GD enabled?
What is the version of the GD library from the line starting with 'GD Version'?
If the heading 'gd' is not there or if the line 'GD Support' shows that the GD library is disabled, ask your host to enable the GD library.
Alternatively, if you have access to the cPanel or equivalent, provided by your host, to manage the web server, go to the Software section and look for PHP or 'PHP Selector', the selection of the PHP version. Check the list of all the PHP extensions and make sure that GD is selected.
The other error comes from the following PHP code in libraries/src/Image/Image.php, line 716:
Code: Select all
// Get the transparent color values for the current image.
$rgba = imagecolorsforindex($this->getHandle(), imagecolortransparent($this->getHandle()));
Ref. PHP: imagecolortransparent
Key Questions
Q1: Where or what exactly is Filesystem Group>Local? Is it a folder in the server or some option in a third party extension?
Q2: How were those images created, meaning which software application created them?
Additional Checks
Go to System - Information - System Information and click the tab PHP Information. Search for 'gd' on the page or locate 'fileinfo' and 'filter', under which you should see the heading 'gd'.
Is the library GD enabled?
What is the version of the GD library from the line starting with 'GD Version'?
If the heading 'gd' is not there or if the line 'GD Support' shows that the GD library is disabled, ask your host to enable the GD library.
Alternatively, if you have access to the cPanel or equivalent, provided by your host, to manage the web server, go to the Software section and look for PHP or 'PHP Selector', the selection of the PHP version. Check the list of all the PHP extensions and make sure that GD is selected.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 49
- Joined: Wed Jun 01, 2022 9:44 pm
Re: $color is out of range
Thanks for your reply.
Q1: Plugins>filesystem/local; according to MySitesGuru, it is best to have thumbnails on.
Q2: The image files on my system come from a variety of sources, some modified by Photoshop. I don't know where else
Q3: in systeminformation>phpsettings> GD Available yes
Q4: Version of GD Library is: 2.3.3, and everything is enabled
The problem only occurred after setting thumbnails to on (Q1)
One more possible hint. I can only replicate this problem when creating a new article. I have JCE editor installed. If I select the insert image icon in the editor, i can add an image without a problem. If instead I go to the buttons at the bottom of the editor and click the "media" button, I get the ..." color out or range" error before selecting an image.
Q1: Plugins>filesystem/local; according to MySitesGuru, it is best to have thumbnails on.
Q2: The image files on my system come from a variety of sources, some modified by Photoshop. I don't know where else
Q3: in systeminformation>phpsettings> GD Available yes
Q4: Version of GD Library is: 2.3.3, and everything is enabled
The problem only occurred after setting thumbnails to on (Q1)
One more possible hint. I can only replicate this problem when creating a new article. I have JCE editor installed. If I select the insert image icon in the editor, i can add an image without a problem. If instead I go to the buttons at the bottom of the editor and click the "media" button, I get the ..." color out or range" error before selecting an image.
- toivo
- Joomla! Master
- Posts: 17439
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: $color is out of range
Those buttons are part of the JCE editor. Which version of JCE does the website use? Is it the free version or the paid Pro version?
The problem may be caused the way JCE processes the images and the color or transparency properties of one or more images in the images folder. It would be best to create a topic at the JCE support forum to get an expert answer.
Toivo Talikka, Global Moderator
-
- Joomla! Apprentice
- Posts: 49
- Joined: Wed Jun 01, 2022 9:44 pm
Re: $color is out of range
toivo Thanks for your help. I am using the basic JCE editor. I note that there is a known bug in the Media Manager editor. I took a look at the images I have been provided, and find that a number of them are oversize. Perhaps that with the "thumbnails" trying reduce them down have caused the problem. Until the bug is fixed, I'll just remove the thumbnails. I'll close this out for now. Thanks again
- toivo
- Joomla! Master
- Posts: 17439
- Joined: Thu Feb 15, 2007 5:48 am
- Location: Sydney, Australia
Re: $color is out of range
Thank you for the update! Which particular bug in Media Manager do you mean?
Toivo Talikka, Global Moderator