It was not possible to determine the dimensions of the image

Get help with installation and running phpBB 3.0.x here. Please do not post bug reports, feature requests, or MOD-related questions here.
Suggested Hosts
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
monotek
Registered User
Posts: 51
Joined: Mon Jan 29, 2007 4:40 pm

It was not possible to determine the dimensions of the image

Post by monotek »

I use PHPBB3 RC1. I configured max image size to 800*600 in acp.

If i try to post a image to a thread or to a private message using bbcode [img] i get the following error message:
It was not possible to determine the dimensions of the image.
PHP function getimagesize() works fine if i test with:

Code: Select all

<?php
$info = getimagesize("image.jpg");
foreach($info as $key => $value) {
    echo $key . ' - ' . $value . '<br />';
}
?>
I get this output:
0 - 83
1 - 90
2 - 2
3 - width="83" height="90"
bits - 8
channels - 3
mime - image/jpeg
What to do to get this work?
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK

Re: It was not possible to determine the dimensions of the image

Post by karlsemple »

If the functions is definitely working on the host you might want to submit this to the bug tracker as it might be a bug :)
Image
monotek
Registered User
Posts: 51
Joined: Mon Jan 29, 2007 4:40 pm

Re: It was not possible to determine the dimensions of the image

Post by monotek »

I thinks its something with my server configuration, because it works here.

:arrow: Image

I also tried to activate allow_url_fopen an shutting down my firewall but the error remains...
User avatar
karlsemple
Former Team Member
Posts: 39802
Joined: Mon Nov 01, 2004 8:54 am
Location: Hereford, UK

Re: It was not possible to determine the dimensions of the image

Post by karlsemple »

You know you tested the getimagesize() functions......did you test it on images on the host.... maybe the host has blocked it from working with external sources..guessing here of course

for example

Code: Select all

<?php

$info = getimagesize('http://www.google.de/intl/de_de/images/logo.gif');

foreach ($info as $key => $value)
{
	echo $value."<br />";
}

>
does that work for you?
Image
monotek
Registered User
Posts: 51
Joined: Mon Jan 29, 2007 4:40 pm

Re: It was not possible to determine the dimensions of the image

Post by monotek »

I solved the Problem :-)

allow_url_fopen was disabled 2 times in php.ini.

First with "disable_functions allow_url_fopen" and then a second time with "allow_url_fopen Off".

After editing both appearances it works. Unfortunately i also have to disable my firewall to get this work.

Therefore i would prefer to check the image size by java script on the client like in my old board...
User avatar
Flai
Registered User
Posts: 29
Joined: Tue Jun 12, 2007 9:42 am
Location: Germany

Re: It was not possible to determine the dimensions of the image

Post by Flai »

karlsemple wrote:You know you tested the getimagesize() functions......did you test it on images on the host.... maybe the host has blocked it from working with external sources..guessing here of course

for example

Code: Select all

<?php

$info = getimagesize('http://www.google.de/intl/de_de/images/logo.gif');

foreach ($info as $key => $value)
{
	echo $value."<br />";
}

>
does that work for you?
I have the same problem and tested your script. The output is:

Code: Select all

301
110
1
width="301" height="110"
8
3
image/gif
My server runs with PHP Version 4.4.0 and phpinfo says allow_url_fopen=On.

:(
< Please write slowly, my english is terrible. > - - - < Visit me: flai-community.de >
User avatar
hryst
Registered User
Posts: 2
Joined: Tue Jun 19, 2007 4:22 pm

Re: It was not possible to determine the dimensions of the image

Post by hryst »

Hello,

I have the same problem with my forum hosted by Dreamhost, caused by switched off attrib "allow_url_fopen". Unfortunatelly, there is no easy way to turn this on.
The function "getimagesize" runs correctly with local files (see: http://www.armedassault.com.pl/test2.php) but can not open a file from other URL.

This error causes that on my forum there is no possibility to view avatars and other new added graphics correctly.
monotek
Registered User
Posts: 51
Joined: Mon Jan 29, 2007 4:40 pm

Re: It was not possible to determine the dimensions of the image

Post by monotek »

Just turn off the image size check...
User avatar
hryst
Registered User
Posts: 2
Joined: Tue Jun 19, 2007 4:22 pm

Re: It was not possible to determine the dimensions of the image

Post by hryst »

It is no solution
User avatar
Jhong
Registered User
Posts: 538
Joined: Thu Aug 10, 2006 6:53 pm
Location: In a theme sandwich

Re: It was not possible to determine the dimensions of the image

Post by Jhong »

Many servers have allow_url_fopen switched off.

A quick workaround is to use cURL to fetch the image and check the size. The mod is as follows:

OPEN: /includes/message_parser.php

FIND:

Code: Select all

			if ($stats === false)
			{
AFTER, ADD:

Code: Select all

				if (function_exists('curl_exec'))
				{
					$c_img = curl_init();
					$c_timeout = 8; //The timeout, in seconds. You may want to change this
					$c_max_filesize = 64000; //The max file size loaded into memory
					curl_setopt($c_img, CURLOPT_URL, $in);
					curl_setopt($c_img, CURLOPT_RETURNTRANSFER, 1);
					@curl_setopt($c_img, CURLOPT_BUFFERSIZE, $c_max_filesize);
					curl_setopt($c_img, CURLOPT_CONNECTTIMEOUT, $c_timeout);
					curl_setopt($c_img, CURLOPT_FOLLOWLOCATION,1);
					$grabbed_img = @curl_exec($c_img);
					curl_close($c_img); 
					$stats[0] = $stats[1] = false;
					if ($grabbed_img)
					{
						$grabbed_img = @imagecreatefromstring($grabbed_img);
						$stats[1] = @imagesx($grabbed_img);
						$stats[0]= @imagesy($grabbed_img);
						unset($grabbed_img, $c_img);
					}
					if (!$stats[0] || !$stats[1])
					{
						$stats = false;
					}
				}
			}
			if ($stats === false)
			{			
Save the file, and the problem should go away. I've tried hard to choose settings in order to prevent the server loading ahuge image into memory by accident, but it may need some tweaking.
phpBB<->WordPress Integration: www.wp-united.com
cyfr
Registered User
Posts: 19
Joined: Fri Oct 06, 2006 5:15 pm

Re: It was not possible to determine the dimensions of the image

Post by cyfr »

Ive tried what you said but I get parse error when I try and put an image in sig.

At the moment all that works is removing restrictions on size. I dont like this as people could use HUGE images.

Any other workarounds? :cry:
emeraldisle
Registered User
Posts: 1
Joined: Wed Jun 27, 2007 11:43 pm

Re: It was not possible to determine the dimensions of the image

Post by emeraldisle »

I had this problem as well. After reading this thread though I went into the php.ini file that my server uses. I downloaded it and opened it with notepad. I changed where it had:

allow_url_fopen = off

to

allow_url_fopen = on

Saved and uploaded and that fixed the problem.

Hope this helps others.

Emeraldisle
cyfr
Registered User
Posts: 19
Joined: Fri Oct 06, 2006 5:15 pm

Re: It was not possible to determine the dimensions of the image

Post by cyfr »

I use dreamhost and I dont think its possible for me to change the php.ini so is there any other way? :(
cyfr
Registered User
Posts: 19
Joined: Fri Oct 06, 2006 5:15 pm

Re: It was not possible to determine the dimensions of the image

Post by cyfr »

Still got this problem, really annoying! :(
monotek
Registered User
Posts: 51
Joined: Mon Jan 29, 2007 4:40 pm

Re: It was not possible to determine the dimensions of the image

Post by monotek »

Jhong wrote:Many servers have allow_url_fopen switched off.

A quick workaround is to use cURL to fetch the image and check the size. The mod is as follows:

OPEN: /includes/message_parser.php

FIND:

Code: Select all

			if ($stats === false)
			{
AFTER, ADD:

Code: Select all

				if (function_exists('curl_exec'))
				{
					$c_img = curl_init();
					$c_timeout = 8; //The timeout, in seconds. You may want to change this
					$c_max_filesize = 64000; //The max file size loaded into memory
					curl_setopt($c_img, CURLOPT_URL, $in);
					curl_setopt($c_img, CURLOPT_RETURNTRANSFER, 1);
					@curl_setopt($c_img, CURLOPT_BUFFERSIZE, $c_max_filesize);
					curl_setopt($c_img, CURLOPT_CONNECTTIMEOUT, $c_timeout);
					curl_setopt($c_img, CURLOPT_FOLLOWLOCATION,1);
					$grabbed_img = @curl_exec($c_img);
					curl_close($c_img); 
					$stats[0] = $stats[1] = false;
					if ($grabbed_img)
					{
						$grabbed_img = @imagecreatefromstring($grabbed_img);
						$stats[1] = @imagesx($grabbed_img);
						$stats[0]= @imagesy($grabbed_img);
						unset($grabbed_img, $c_img);
					}
					if (!$stats[0] || !$stats[1])
					{
						$stats = false;
					}
				}
			}
			if ($stats === false)
			{			
Save the file, and the problem should go away. I've tried hard to choose settings in order to prevent the server loading ahuge image into memory by accident, but it may need some tweaking.
Nice. Maybe this is a workaround for a lot of peaople. Please add this patch to the bugtracker. Maybe its implemeted in phpbb3 final :-)

Return to “[3.0.x] Support Forum”