getimagesize() error in php [duplicate] - php

This question already has answers here:
trying to turn on allow_url_fopen by putting php.ini in wordpress root does not work
(6 answers)
Closed 8 years ago.
So I am using the getimagesize function to get the size of the image. The line I use is the following:
list($width, $height) = getimagesize($imagen);
The variable $imagen is the right one as if I echo it, I get the image url, and the image does exist.
any idea?Edit: allow_url_fopen is on and the error I get is the following:
Warning: getimagesize(): Couldn't resolve host name in /home/u969736199/public_html/web/productos.php on line 43 Warning: getimagesize(http://snapi2.vv.si/web/images/productos/R2203054.jpg): failed to open stream: operation failed in /home/u969736199/public_html/web/productos.php on line 43 http://snapi2.vv.si/web/images/productos/R2203054.jpg
What I get from var_export($imagen); and var_export(is_readable($imagen)); is:
http://snapi2.vv.si/web/images/productos/EE523152.jpg'http://snapi2.vv.si/web/images/productos/EE523152.jpg'false

If you are retrieving a remote image you need to make sure that you enable
allow_url_fopen
in php.ini.

The url you are accessing doesn't resolve. If you go to http://snapi2.vv.si/web/images/productos/EE523152.jpg in the browser you will get a server not found page.

Related

PHP Warning failed to open stream: No such file or directory [duplicate]

This question already has answers here:
PHP - Failed to open stream : No such file or directory
(10 answers)
Closed 3 years ago.
When i try to access the page give me a php warning :
md5_file(/public_html/: failed to open stream: No such file or directory
But there is a dot after "pages-oubliee" and i don't know where this come from. And how to get rid of this, this dot prevents me from accessing the real directory
it seems the dot comes from a selectPerso.php file, specifically from this line
'fileName'=> './flash/personnalisationV2bis.swf',
Try removing the dot there and see if it helps.

Verify url type

I am trying to figure out ways to determine whether the url I am passing is an image or not. I have thought using getimagesize() to accomplish this task. But the main problem is, what if I want to check the image size of an encrypted image such as this url (https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTup5KSMveqkgrDKZR6p-0ANhPkJ7srbJOlKR78DUqqh85I_3MUrw)?
I am always getting this error:
Warning: getimagesize(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in C:\xampp\htdocs\series\index.php on line 4
Warning: getimagesize(https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTup5KSMveqkgrDKZR6p-0ANhPkJ7srbJOlKR78DUqqh85I_3MUrw): failed to open stream: No such file or directory in C:\xampp\htdocs\folder\index.php on line 4
0
Couple of bits:
If you are running PHP5 (or could do) then you can use the HTTP Stream wrapper with the php.ini setting 'allow_url_fopen' set to on:
This will allow you to do a 'straight forward' copy of any remote data to your server for processing.
e.g
<?php copy('https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTup5KSMveqkgrDKZR6p-0ANhPkJ7srbJOlKR78DUqqh85I_3MUrw', 'FileName.jpg'); ?>
Then you can do:
<?php
$size = getimagesize("FileName.jpg");
echo $size;
/*delete temp file*/
unlink("FileName.jpg");
?>
Obviously not complete - but you can see the theory there

Admin panel not accessible in wordpress [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 9 years ago.
I have deployed the wordpress blog on my site sqlhelps.com. The site is hosted on asp.netdiscount server. I cannot access the sqlhelps.com/wp-admin. The error is as follows :
Warning: require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php): failed to open stream: No such file or directory in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60 Fatal error: require_once(): Failed opening required 'E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php' (include_path='.;C:\php\pear') in E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60
Can anyone please help me out with this?
Either user.php is not available on your server or you are giving the wrong path as you can see error is :
No such file or directory in E:\web\.......
In E:\web\sqlhelpscom\htdocs\wp-admin\includes\admin.php on line 60, try changing
require_once(E:\web\sqlhelpscom\htdocs/wp-admin/includes/user.php)
to
require_once(E:\web\sqlhelpscom\htdocs\wp-admin\includes\user.php)
so all the slashes are going the same way.
Jason

How to check if the remote server images exist? [duplicate]

This question already has answers here:
How can one check to see if a remote file exists using PHP?
(24 answers)
Closed 9 years ago.
I am trying to test if the remote images exist before I process my codes..
I have found this post
How can one check to see if a remote file exists using PHP?
I have tried getimagesize function and file_get_contents function but I got
Warning: getimagesize() [function.getimagesize]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in /project/testImages.php on line 147
I can't modify the server configuration in my case.
I am not sure how to solve the errors or if there are another ways to workaround.
Thanks for any help.
Why don't you try cURL with CURLOPT_HEADER set to 1 (or true)? Then just check the returned contents for server response. That's the way I'd do it.

getimagesize() error: "failed to open stream: No such file or directory" [duplicate]

This question already has answers here:
PHP - Failed to open stream : No such file or directory
(10 answers)
Closed 6 years ago.
I get the following error:
getimagesize(barbie2.jpeg) [function.getimagesize]: failed to open stream: No such file or directory
On line:
list($hight, $width) = getimagesize($name);
in getimagesize() you need to specify path of the image. Probably it is not getting image path so it is giving you error.
your file from where you have called this function and image location is different so it is giving you error.
You can specify the path of the image by using $_FILES["fileToUpload"]["tmp_name"] because when you upload the file is stored in the temp directory.

Categories