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.
Ideas Centre
Forum rules
END OF SUPPORT: 1 January 2017 (announcement)
Locked
MIX_M@N
Registered User
Posts: 2
Joined: Sun Apr 06, 2008 6:47 pm

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

Post by MIX_M@N » Sun Apr 06, 2008 11:58 pm

Neither of those work...
Is there any way to get around that?

As I said earlier, I've tried the workaround w/ no success.

I heard one user use Javascript...
How would I do that?

BTW: Thanks! :D

gerbus3
Registered User
Posts: 3
Joined: Mon Apr 07, 2008 1:37 am

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

Post by gerbus3 » Mon Apr 07, 2008 1:40 am

Hi, I ran this script:

Code: Select all

    <?php

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

    foreach ($info as $key => $value)
    {
       echo $value."<br />";
    }
    ?>
The script returned the dimensions of the image (as in the previous post), and yet I still get the error when I try to hotlink an image:
It was not possible to determine the dimensions of the image.
Any ideas where I should look?

Arkantos Khan
Registered User
Posts: 51
Joined: Wed Jun 29, 2005 5:44 am

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

Post by Arkantos Khan » Mon Apr 07, 2008 8:12 am

iWisdom wrote:As I've explained multiple times, this error message is not a bug in phpBB.
I disagree. This IS a bug. All these things about different web servers settings ALWAYS MUST be considered when you make a test of something like phpBB.

I see a lot of people complaining about this problem with "getimagesize" (one of the best improvements since phpBB2), all the people have different hosting providers and, ergo, web servers, so... are you telling me that the developer team tested Olympus in only one webserver? Are you telling me that the developer team has made something "safe" in spite of the fact that servers have this option disabled for some good reason (you know, security).

Most of the users post images from other sites in the forums... just think about it. The image size limit option is useless if you cannot get the size of the images, hello?

User avatar
Eelke
QA Team
Posts: 2903
Joined: Thu Dec 20, 2001 8:00 am
Location: NL, Bussum
Name: Eelke Blok
Contact:

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

Post by Eelke » Mon Apr 07, 2008 2:57 pm

marcus0263 wrote:Is there any work on a patch to fix this hole?
Marcus, your quote only explains why in general providers would disallow url_fopen; because when used incorrectly, it can pose a security hole. That does not mean it is inherently insecure to use the functionality, if used responsibly. It's like a steak knife, that some providers choose not to provide because chances of one of their users going and running around with it is just too big. Doesn't mean it's no good to cut steaks with.

Infinitee
Registered User
Posts: 4
Joined: Fri Apr 18, 2008 1:56 pm

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

Post by Infinitee » Sun Apr 20, 2008 9:42 pm

iWisdom wrote: just try to run this script.
Excuse my ignorance but, exactly how and where do you "run this script"?

sonar
Registered User
Posts: 8
Joined: Thu Apr 17, 2008 12:17 pm

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

Post by sonar » Sun Apr 20, 2008 11:09 pm

I also still has this problem.

I ran the code a few posts up and it returned correct answer, I've searched this forum and tried everything I guess now, the board is 3.0.1 clean installation (no upgrade).

Avatar upload has the same error, but after it also says: "The submitted avatar is 0 pixels wide and 0 pixels high.." whatever image I submit. I've been searching my apache virtual directory configuration for errors too but don't really know what to look for. images, images/avatars/upload, files is chmodded 777.

User avatar
Phil
Former Team Member
Posts: 10403
Joined: Sat Nov 25, 2006 4:11 am
Name: Phil Crumm
Contact:

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

Post by Phil » Sun Apr 20, 2008 11:35 pm

Arkantos Khan wrote:
iWisdom wrote:As I've explained multiple times, this error message is not a bug in phpBB.
I disagree. This IS a bug. All these things about different web servers settings ALWAYS MUST be considered when you make a test of something like phpBB.
The thing is, many hosts also do not. As Eeike explained, this function is like a steak knife -- it can be dangerous if used improperly, but if used properly as it is within phpBB it's perfectly fine.
Infinitee wrote:
iWisdom wrote: just try to run this script.
Excuse my ignorance but, exactly how and where do you "run this script"?
You save it as a .php file (say, test.php), upload it to your server space, and browse to it.
Moving on, with the wind. | My Corner of the Web

Infinitee
Registered User
Posts: 4
Joined: Fri Apr 18, 2008 1:56 pm

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

Post by Infinitee » Mon Apr 21, 2008 9:48 am

Thanks guys,

Here are my results:

Warning: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration in /home/5120/domains/community.infinitee-designs.com/html/phpBB3/test.php on line 3

Warning: getimagesize(http://www.google.de/intl/de_de/images/logo.gif) [function.getimagesize]: failed to open stream: no suitable wrapper could be found in /home/5120/domains/community.infinitee-designs.com/html/phpBB3/test.php on line 3

Warning: Invalid argument supplied for foreach() in /home/5120/domains/community.infinitee-designs.com/html/phpBB3/test.php on line 5


The question is, since I was able to have images hotlinked a couple of days ago I figure the reason I can't do it now is from some change I made is some setting somewhere. Does anyone have an idea of which settings in the ACP that might turn this ability off, or is it something that I need to talk to my host about?

phpBB 3.01 + prosilver + mySQL 4.1.11 + PHP 5

Thanks again,
Ralph

Infinitee
Registered User
Posts: 4
Joined: Fri Apr 18, 2008 1:56 pm

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

Post by Infinitee » Mon Apr 21, 2008 10:47 am

Article 793
Created 1-8-2008
Modified 2-9-2008

Here is what my host "Media Temple" says about this topic in their knowledge base:

Why is allow_url_fopen disabled on the (gs) Grid-Service?

This article applies to:

* (gs) Grid-Service

DETAILS:

The PHP parameter allow_url_fopen has been disabled in both our PHP4 and PHP5 environments for the (gs) Grid-Service.
BACKGROUND:

If enabled, allow_url_fopen allows PHP's file functions to retrieve data from remote locations such as an FTP server or web site, and could lead to code injection vulnerabilities. Typically these code injection vulnerabilities occur from improper input filtering when passing user-provided data to PHP functions. Disabling this function will help considerably in stopping your site(s) from being compromised, as well as help thwart the unauthorized use of our servers for abusive or malicious purposes.

WHAT YOU SHOULD DO:

We would highly suggest further researching and examining aspects of your site's code that depend on this functionality. There are many safer methods to accomplish the same desired results without this possible security issue.

* Use a relative path to the file stored locally
* Using the PHP environment variable $_SERVER['DOCUMENT_ROOT'], which returns the absolute path to the web root directory.
* cURL is another method that could be used. (This method is beyond the scope of this article.)

If this software was obtained from a 3rd party we suggest contacting their developer. These developers can usually be contacted via forums, email or other methods.

WORKAROUND:
Warning: This workaround method should only be used as a temporary solution.

You can enable 'allow_url_fopen' by editing your article php.ini . The process is very straightforward; it is as simple as including the following line to your own php.ini file at /home/####/etc/php.ini (Replace the #### with your site number) If you are just starting to use a custom php.ini file you may need to also change the memory_limit value as well.

allow_url_fopen = On

Q&A

Q: After making this change my sites no longer work and I get the error "Fatal error: Allowed memory size of 8388608 bytes exhausted..", how do I fix this?

A: Please be sure to also add the following to your php.ini.

memory_limit = 100M
cgi.fix_pathinfo=1

------------------------------------------

Can anyone out there share some knowledge about how to precisely do any of these with phpBB3?

* Use a relative path to the file stored locally
* Using the PHP environment variable $_SERVER['DOCUMENT_ROOT'], which returns the absolute path to the web root directory.
* cURL is another method that could be used. (This method is beyond the scope of this article.)


Thanks,

Infinitee
Registered User
Posts: 4
Joined: Fri Apr 18, 2008 1:56 pm

Re: How to implement cURL

Post by Infinitee » Mon Apr 21, 2008 12:41 pm

Implementing cURL worked for me: phpBB3 + prosilver + Host media temple.

See post: http://www.phpbb.com/community/viewtopi ... &sk=t&sd=a

By Jhong - Middle of the page.

1. Find:

Code: Select all

             if ($stats === false)
             {
2. Replace with:

Code: Select all

             if ($stats === false)
             {
                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)
             {         
3. Upload file: message_parser.php

*Note: I changed my "Timeout" from 8 to 30 seconds for larger images and animations!

Good luck,

Ralph

PrometheusKZ
Registered User
Posts: 76
Joined: Mon May 08, 2006 9:07 pm
Contact:

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

Post by PrometheusKZ » Sat Apr 26, 2008 3:05 pm

Where I can see the getimagesize() properties? What functions used in phpBB 2*? Now I have not showing many images on my forums...

Is there alternative?
Thank you.

User avatar
takufner
Registered User
Posts: 209
Joined: Mon Oct 23, 2006 10:39 am
Location: Rio de Janeiro - Brasil
Name: Prof. Caju
Contact:

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

Post by takufner » Sat May 03, 2008 10:13 pm

Hi all,

The function getimagesize() in my server is working properly with external images.

But, with internal images, I have some problem.

With the code

Code: Select all

<?php
$info = getimagesize("../images_matematica/inicio.gif");
foreach ($info as $key => $value)
{
echo $value."<br />";
}
?>
Everything is ok, the result is

Code: Select all

25
13
1
width="25" height="13"
8
3
image/gif
But, if I use the code:

Code: Select all

<?php
$info = getimagesize("http://www.tutorbrasil.com.br/images_matematica/inicio.gif");
foreach ($info as $key => $value)
{
echo $value."<br />";
}
?>
The result is:

Code: Select all

Warning: getimagesize(http://www.tutorbrasil.com.br/images_matematica/inicio.gif) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /backup/tutorbra/public_html/phpBB3/teste.php on line 2

Warning: Invalid argument supplied for foreach() in /backup/tutorbra/public_html/phpBB3/teste.php on line 3
And, because of this I get a lot of error while converting my phpBB2 to phpBB3. The [img] tags in my site are all pointing to http://tutorbrasil.com.br/forum/userpix.

Can someone help me?

Thanks

sonar
Registered User
Posts: 8
Joined: Thu Apr 17, 2008 12:17 pm

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

Post by sonar » Mon May 12, 2008 11:42 am

I had my problem solved...

getimagesize() was working fine for me but when I uploaded pictures it failed anyway even thought script was correct and upload was correct.
The problem in my case was that I had a little filesystem-mount-error so I noticed the uploaded pictures became 0 byte in size. So of course the script returned the imagedimension was wrong.

So my tips when troubleshooting this is:
1. Check if getimagesize() returns correct answer from a remote pic with the code (written many times in this thread, but here it is again)

Code: Select all

<?php
$info = getimagesize('http://www.google.de/intl/de_de/images/logo.gif');
foreach ($info as $key => $value)
{
   echo $value."<br />";
}
?>
2. Check if file uploads correct
3. Check if getimagesize() returns correct answer from the uploaded picture manually

User avatar
michaelo
Registered User
Posts: 1292
Joined: Thu Jun 13, 2002 3:49 am
Location: Dublin, Ireland
Name: Michael O'Toole
Contact:

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

Post by michaelo » Wed Jul 30, 2008 11:11 am

Got the same error but I found I had my site disabled... make sure your not testing with your site disabled... Could happen ;)
Contributions: Mods & Styles Extensions
(site is down): Kiss Portal Engine

vwpoloclub
Registered User
Posts: 5
Joined: Mon Sep 10, 2007 12:46 pm

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

Post by vwpoloclub » Sat Aug 09, 2008 4:01 pm

Hi guys.

Unfortunately none of these suggestions worked for me. My host also disables allow_url_fopen an getimagesize php calls with "outside" URLs did not work for me too.

But I was told by my host's support that there would be possible to (temporally) enable that call in my php code. Now it is disabled 99,99% of time because I changed my code to enable/disable that funcion it just berore/after getimagesize calls.

Here is the tip:
ini_set("allow_url_fopen", 1); // To enable allow_url_fopen...

// getimagesize call...

ini_set("allow_url_fopen", 0); // To disable allow_url_fopen...
So I changed the following files:

- message_parser.php (for post reply with images)
- functions_user.php (for remote avatar submission)

Note: Do not expect that init_set with allow_url_fopen parameter will work for all your hosts, but there is a piece of code that shows which functions access can be changed by that call:
// File: iniset_test.php

<style>
table{
position: relative;
left: 100px;
}
td {
padding:2px;
border: 1px solid #9999ff;
font-family: verdana,geneva,arial;
font-size:12px;
text-align: center;
}
h3{font-family: verdana,geneva,arial;
font-size:18px;
text-align: center;
color:#0000ff;
}
</style>

<?php
function clean_item ($p_value) {

if (is_array ($p_value)) {
if ( count ($p_value) == 0) {
$p_value = null;
} else {
foreach ($p_value as $m_key => $m_value) {
$p_value[$m_key] = clean_item ($m_value);
if (empty ($p_value[$m_key])) unset ($p_value[$m_key]);
}
}
} else {
if (($p_value)<=6) {
$p_value = null;
}
}
return $p_value;
}

$m_array=ini_get_all();

$m_clean = clean_item ($m_array);

Echo '<h3>Directives controlled by ini_set</h3>';

echo '<table>';
$x=0;
foreach($m_clean as $m_key1 => $m_value){
if($x%5==0 ){
echo'<tr>';
}

echo'<td>'.$m_key1.'</td>';
$x++;
if($x %5==0 ){

echo'</tr>';
$x=0;
}
}
echo ' </table>';
?>
I hope it helps.

Good luck!

Locked

Return to “[3.0.x] Support Forum”