我想找出在哪里指定 facebook.png
的图像大小,即 24x24。
下面是代码,但我不确定如何指定大小。我知道如何在 HTML 中执行此操作,但在 PHP 中不知道。
<?php if ( get_option('solostream_facebook_url') ) { ?>
<a title="<?php echo stripslashes(get_option('solostream_facebook_link_text')); ?>" rel="external" href="http://www.facebook.com/<?php echo stripslashes(get_option('solostream_facebook_url')); ?>"><img class="facebook-sub" src="<?php bloginfo('template_directory'); ?>/images/facebook.png" alt="<?php echo stripslashes(get_option('solostream_facebook_link_text')); ?>" align="top" /></a>
<?php } ?>
最佳答案
添加 height
和 width
<img>
的属性.检查下面的代码。
<?php if ( get_option( 'solostream_facebook_url') ) { ?>
<a title="<?php echo stripslashes(get_option('solostream_facebook_link_text')); ?>" rel="external" href="http://www.facebook.com/<?php echo stripslashes(get_option('solostream_facebook_url')); ?>"><img class="facebook-sub" src="<?php bloginfo('template_directory'); ?>/images/facebook.png" alt="<?php echo stripslashes(get_option('solostream_facebook_link_text')); ?>" align="top" height="24" width="24"/></a>
<?php } ?>
关于php - 指定由 PHP 文件调用的图像宽度和高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36544736/