I'm working with wordpress locally and for some reason when I call getimagesize() from page.php to retrieve the sizes it does not work. I get the warning:
getimagesize(http://localhost:8080/wordpress/wp-content/themes/minimize/_/images/img-2.jpg )
[function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.0 404
Not Found in C:\wamp\www\wordpress\wp-content\themes\minimize\page.php on line 13
The actual code that is calling it is:
$items = get_post_meta($post->ID, 'test');
foreach($items as $item) {
$img_pth = 'http://localhost:8080/wordpress/wp-content/themes/HTML5-Reset-Wordpress-Theme/_/images/'.$item;
list($width, $height) = getimagesize($img_pth);
echo '<img src="'.$img_pth.'" height="'.$height.'" width="'.$width.'">';
}
I'm new to working with PHP so I wouldn't be surprised if it is something very obvious with my code, but I think what I'm trying to do is pretty easy and straight forward. I've tried changing localhost to 127.0.0.1 as I saw in another thread but to no avail. The images are being rendered, so the image paths are correct, but the function is failing. Thanks for any help I can get...
I had the same problem.
Use relative path to the file instead.