Content between shortcodes

An Example Shortcode:(Taken from: GenerateWP: Shortcodes Generator

// Add Shortcode
function img_shortcode( $atts , $content = null ) {

    // Attributes
    extract( shortcode_atts(
        array(
            'width' => '',
            'height' => '',
        ), $atts )
    );
    // Code
// This is the line you need to study:
return '<img src="' . $content . '" width="' . $width . '" height="' . $height . '">';

}
add_shortcode( 'img', 'img_shortcode' );

This is the default [img] tag used by phpBB and others as a “shortcut” to posting an image. Notice that to return HTML you must do it in raw format. You cannot stack the output across multiple functions, i.e. Pass function 1 to function 2, and expect function 2 to be overloaded with function 1’s content.

UPDATE

Using the example I gave you earlier, I scribbled this together, I can’t promise it will behave the way I expect, nor is there a way to add images except manually:

// Add Shortcode
function automatic_ads_shortcode( $atts , $content = null ) {

    // Attributes
    extract( shortcode_atts(
        array(
            'width' => '',
            'height' => '',
        ), $atts )
    );
    // Code
    // Set the $image_array base_dir to the Media Library Path
    define('IMAGES_PATH', dirname(realpath('/wp-content/uploads/')));

    //Ad Rotator 
    //Array of Ads
    //Manually add your ad images to this array. Due
    //to the functionality of a Shortcode, there is no
    //way to accept user input.  You'd need a plugin
    //for that. 
    $image_array = array(IMAGES_PATH . 'img1.jpg',
                         IMAGES_PATH .'img2.jpg',
                         IMAGES_PATH .'img_x.jpg');             
    $current_week = date(W);

    // Shuffling + Random ensures we don't
    // get the same image twice in a row.
    // Every 8 Weeks = 2 months
    if ($current_week % 8 == 0)
    {
        $shuffled_array = shuffle($image_array);
        $chosen_image = array_rand($shufled_array,1);
    }
    //Every 4 Weeks = 1 month
    elseif ($current_week % 4 == 0)
    {
        $shuffled_array = shuffle($image_array);
        $chosen_image = array_rand($shufled_array,1);

    }
    // All other Cases
    else {
        $chosen_image = array_rand($image_array,1); 
    }
//Output Line
return '<img src="' . $chosen_image . '" width="' . $width . '" height="' . $height . '">';

}
add_shortcode( 'auto_ads', 'automatic_ads_shortcode' );

After Testing this, use the shortcode [auto_ads] and add said shortcode in the section where the ads normally appear. As you can see, I stick by the idea that you cannot stack output.

error code: 523