Found the solution
function nerdy_get_images($size = 'thumbnail', $limit = '0', $offset = '0') {
global $post;
$images = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
if ($images) {
$num_of_images = count($images);
if ($offset > 0) : $start = $offset--; else : $start = 0; endif;
if ($limit > 0) : $stop = $limit+$start; else : $stop = $num_of_images; endif;
$i = 0;
echo '<ul>';
foreach ($images as $image) {
if ($start <= $i and $i < $stop) {
$img_title = $image->post_title; // title.
$img_description = $image->post_content; // description.
$img_caption = $image->post_excerpt; // caption.
$img_url = wp_get_attachment_url($image->ID); // url of the full size image.
$img_url_large = wp_get_attachment_url($image->ID, 'medium'); // url of the full size image.
$preview_array = image_downsize( $image->ID, $size );
$img_preview = $preview_array[0]; // thumbnail or medium image to use for preview.
$thumb_id = get_post_thumbnail_id(get_the_ID());
///////////////////////////////////////////////////////////
// This is where you'd create your custom image/link/whatever tag using the variables above.
// This is an example of a basic image tag using this method.
?>
<li<?php if ($thumb_id == $image->ID) {echo ' class="main-image"';}?> ><a href="<?php echo $img_url_large; ?>"><img src="<?php echo $img_preview; ?>" alt="<?php echo $img_caption; ?>" title="<?php echo $img_title; ?>"></a></li>
<?
// End custom image tag. Do not edit below here.
///////////////////////////////////////////////////////////
}
$i++;
}
echo '</ul>';
}
}