Getting images size using php or javascript / jquery - getimagesize fails -
i'm using lightbox script needs me output image sizes. site i'm using php , can resize images uploaded. not store images sizes in database.
the code needs displayed follows.
<a href="http://www.fullurl.com/image.jpg" data-original-url="http://www.fullurl.com/image.jpg" data-original-width="123" data-original-height="456"> <img src="http://www.fullurl.com/thumbnail-image.jpg" alt="product name" /> </a> i've tried using getimagesize works on images have not been resized system. think missing vital info images have uploaded not resized work fine. there 1200 images uploaded redoing them not option.
my current method using php follows.
<?php $image1 = 'http://www.fullurl.com/thumbnail-image.jpg'; list($width, $height) = getimagesize($image1); ?> <a href="http://www.fullurl.com/image.jpg" data-original-url="http://www.fullurl.com/image.jpg" data-original-width="123" data-original-height="456"> <img src="http://www.fullurl.com/thumbnail-image.jpg" alt="product name" /> </a> if use following bool(false) output.
$path1 = 'http://www.fullurl.com/image.jpg'; $vals_arr1 = getimagesize($path1); echo "<pre>";var_dump($vals_arr1);echo "</pre>"; i'm not programmer. question how can output image info below? i'm happy try alternative php, jquery / javascript needed. ideally needs simple , fast.
<a href="http://www.fullurl.com/image.jpg" data-original-url="http://www.fullurl.com/image.jpg" data-original-width="123" data-original-height="456">
this works
$path1 = 'https://jpeg.org/images/jpeg-home.jpg'; $vals_arr1 = getimagesize($path1); echo "<pre>";var_dump($vals_arr1);echo "</pre>"; the bug must somewhere else. check urls! valid? , check if allow_url_fopen set true on server.
else can help: https://stackoverflow.com/a/25231517/4916265
Comments
Post a Comment