php - how can i Echo "text" only if attached thumbnail is bigger than "X" resolution in wordpress? -
can please me out following.
how can echo "text" if attached thumbnail resolution on 500px x 500px in wordpress?
i want echo link if attached thumbnail bigger specified image resolution.
thanks.
found solution
<?php $imgdata = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumbnail' ); $imgurl = $imgdata[0]; // url of thumbnail picture $imgwidth = $imgdata[1]; // thumbnail's width $imgheight = $imgdata[2]; // thumbnail's height if ($imgwidth >= 200 || $imgheight >= 200){ echo 'success'; } else { echo "nope"; }?>
Comments
Post a Comment