How to dynamically get image dimensions with PHP
Question:
How to dynamically get image dimensions (image height and width) and use it in Advanced Layer Popup?
If you use PHP for server-language, you can use the following code to get the dimensions of particular image:
How to dynamically get image dimensions (image height and width) and use it in Advanced Layer Popup?
Answer:
If you use PHP for server-language, you can use the following code to get the dimensions of particular image:
<?php list($w, $h) = getimagesize("Images/Sunset.jpg") ?>
Then replace the with and height into parameters of the Advanced Layer javascript function with $w and $h values. For exmaple:
<a href="#" onclick="dmxAdvLayerPopup('Sunset','Images/Sunset.jpg','alpSunset','','OS_Look','center','center', <?php echo $w ?>, <?php echo $h?>, 0,true,false,false,0,'','Linear',2,true,'','Linear',2,true,'',1,5,true,false,'#FFFFFF');return document.MM_returnValue">Sunset</a>
Also, instead the static path and picture filename (Images/Sunset.jpg) you can use picture name and path from database.
Comments
Be the first to write a comment
You must me logged in to write a comment.