I solved this problem with getting current category id and using it like this:
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
foreach((get_the_category()) as $category) { $postcat= $category->cat_ID; }
$wp_query->query('cat=' . $postcat . '&paged=' . $paged);
?>
<?php while ($wp_query->have_posts()): $wp_query->the_post();?>
<?php
$img_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts where post_parent= $post->ID and (post_mime_type = 'image/jpeg' OR post_mime_type = 'image/gif' OR post_mime_type = 'image/png') and post_type = 'attachment'");
$img_array = wp_get_attachment_image_src($img_id, 'thumbnail', false);
$img_array_l = wp_get_attachment_image_src($img_id, 'large', false);
?>
<li><a href="<?php echo $img_array_l[0]; ?>" rel="photos"><?php echo '<img src="'.$img_array[0].'"' . ' alt="'.get_the_title().'" />'; ?></a></li>
<?php endwhile;?>