Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $args = array(
- 'posts_per_page' => 4,
- 'orderby' => 'rand',
- 'category__not_in' => 439
- );
- query_posts($args);
- while (have_posts()) : the_post(); $do_not_duplicate = $post->ID;
- $output = preg_match_all('/<img[^>]+src=[\'"]([^\'"]+)[\'"][^>]*>/i', get_the_content(), $matches);
- $imageurl = $matches[1][0];
- $percenta = 100;
- $upravenawidth = 110;
- $upravenaheight = 110;
- list($width, $height) = getimagesize($imageurl);
- if($height > $upravenaheight && $width <= $upravenawidth)
- {
- while($height > $upravenaheight ){
- $percenta = $percenta - 1;
- $height = $height / 100 * $percenta;
- $width = $width / 100 * $percenta;
- }
- }
- if($width > $upravenawidth && $height <= $upravenaheight)
- {
- while($width > $upravenawidth ){
- $percenta = $percenta - 1;
- $width = $width / 100 * $percenta;
- $height = $height / 100 * $percenta;
- }
- }
- if($width > $upravenawidth && $height > $upravenaheight)
- {
- while($width > $upravenawidth ){
- $percenta = $percenta - 1;
- $width = $width / 100 * $percenta;
- $height = $height / 100 * $percenta;
- }
- while($height > $upravenaheight ){
- $percenta = $percenta - 1;
- $width = $width / 100 * $percenta;
- $height = $height / 100 * $percenta;
- }
- }
- ?>
- <div class="bf-border">
- <div class="rssitem"><div class="pinkhover">
- <a class="clickable" href="<? the_permalink(); ?>" rel="bookmark" title="" target="_top"><? the_title(); ?></a><br /><br /><br /></div>
- <div class="rssanotacia"><a href="<? the_permalink(); ?>" rel="bookmark" title="" target="_top"><img src="<?php echo $imageurl; ?>" width="<?php echo $width; ?>" height="<?php echo $height; ?>" style="margin-top:<?php echo((110 - $height) / 2); ?>px" /></a></div>
- </div>
- </div>
- <br />
- <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment