Exemple #1
0
        /// <summary>
        /// Get image media that can be created via the
        /// Campaign Management API.
        /// </summary>
        /// <param name="mediaType">The media type reflects the aspect ratio.</param>
        /// <param name="imageFileName">The file name and path.</param>
        /// <param name="imageFormat">For supported image formats see <see href="https://go.microsoft.com/fwlink/?linkid=872754">Image remarks</see>.</param>
        /// <returns>A Campaign Management Image object.</returns>
        private Microsoft.BingAds.V12.CampaignManagement.Image GetImageMedia(
            string mediaType,
            string imageFileName,
            System.Drawing.Imaging.ImageFormat imageFormat)
        {
            var image = new Microsoft.BingAds.V12.CampaignManagement.Image();

            image.Data      = GetBmpBase64String(imageFileName, imageFormat);
            image.MediaType = mediaType;
            image.Type      = "Image";

            return(image);
        }
Exemple #2
0
        private IList <Media> GetImageMedia()
        {
            var media = new List <Media>();
            var image = new Microsoft.BingAds.V12.CampaignManagement.Image();

            // This example uses an image with 1.5:1 aspect ratio.
            // For more information about available aspect ratios and min / max dimensions,
            // see the Image data object reference documentation.

            image.Data      = GetImage15x10Data();
            image.Type      = "Image15x10";
            image.MediaType = "Image";
            media.Add(image);

            var request = new AddMediaRequest
            {
                Media = media
            };

            return(media);
        }