I found this code to get the image size in javascript:
function getImgSize(imgSrc) { var newImg = new Image(); newImg.src = imgSrc; var height = newImg.height; var width = newImg.width; alert ('The image size is '+width+'*'+height); }
It works fine, but I need to get the size of the protected image; do i use image.php to access the image? id = IMAGE_ID, and it works because on this page I check permissions and send the image back. But when I put this link in a javascript function to get its size, it does not work. Any help (if I put a direct link to an image that it does not work because it is locked in a .htaccess file)?
The folder containing the images also contains the .htaccess file, which is available for denny access. To get the image, I use this PHP page:
image.php:
//check if the user has permission //if not, show a image with the text 'no permission' //if it ok $filename = "images\\fotos\\" . $imgl; $image = imagecreatefromjpeg($filename); header('Content-type: image/jpeg'); imagejpeg($image, null, 100); imagedestroy($image);
source share