Php 图像高宽问题

Php 图像高宽问题,php,javascript,jquery,html,css,Php,Javascript,Jquery,Html,Css,如何使用jQuery更改图像分辨率。我已经使用css/php在身体背景上应用了一个图像。现在我想对图像应用屏幕高度和宽度,以便图像在整个窗口中显示。 事实上,我没有使用重复的风格 使用的代码是: <style type="text/css"> <?php global $post; if ( has_post_thumb

如何使用jQuery更改图像分辨率。我已经使用css/php在身体背景上应用了一个图像。现在我想对图像应用屏幕高度和宽度,以便图像在整个窗口中显示。 事实上,我没有使用重复的风格

使用的代码是:

 <style type="text/css">
                    <?php
                            global $post;   
                            if ( has_post_thumbnail($post->ID) ) { 
                                    $image_id = get_post_thumbnail_id($post->ID);
                                    $bg_src = wp_get_attachment_image_src( $image_id, 'full');
                            ?>
                        body { background: #000000 url("<?php echo $bg_src[0]; ?>") no-repeat center top fixed !important; }
                            <?php } else { ?> 
                        body { background: #000000 url("<?php bloginfo('template_directory') ?>/img/bg_img.jpg") no-repeat center top fixed ; }
                            <?php } ?>
        </style>       

您可以在body标记之后添加此html:

<img src='img/bg_img.jpg' style='display:none;' id='image_hidden'/>


用jquery获取这幅图像的高度。

你不能用css改变背景图像的大小。

你是否意识到如果你同时改变这两幅图像,你会弄乱纵横比?如果只更改宽度,则高度将是所需的任何值CSS3最后有一个背景大小属性。一旦它在浏览器中得到广泛支持,只需将高/宽设置为100%就更容易了在那之前,你需要一种不同的方法。
<img src='img/bg_img.jpg' style='display:none;' id='image_hidden'/>