Ejemplo n.º 1
0
 protected void ImageUpload1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
 {
     if (this.ImageUpload1.SourceImageSize.Width < 250)
     {
         // The uploaded image is too small
         this.ImageUpload1.UnloadImage();
         this.ImageUpload1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">Image width must be at least 250 px.</span>");
         return;
     }
 }
 protected void Picture1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
 {
     // Auto-Apply the right crop constraint depending on the source image size
     if (this.Picture1.SourceImageSize.Width > this.Picture1.SourceImageSize.Height)
     {
         // Landscape -> Configuration = 0
         this.Picture1.SelectedConfigurationIndex = 0;
     }
     else
     {
         // Portrait -> Configuration = 1
         this.Picture1.SelectedConfigurationIndex = 1;
     }
     args.CropConstraint = this.GetCropConstraint(this.Picture1.SelectedConfigurationIndex.Value);
 }
    protected void Picture1_ImageUpload(object sender, SimpleImageUpload.ImageUploadEventArgs args)
    {
        this.MyLogEvent("New image uploaded.");

        if ((this.Picture1.SourceImageSize.Width < 100) || (this.Picture1.SourceImageSize.Height < 150))
        {
            // The uploaded image is too small
            this.Picture1.UnloadImage();
            this.Picture1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">The uploaded Image is too small.</span>");
            return;
        }

        if ((this.Picture1.SourceImageSize.Width > 1500) || (this.Picture1.SourceImageSize.Height > 1600))
        {
            // The uploaded image is too large
            this.Picture1.UnloadImage();
            this.Picture1.SetCurrentStatusMessage("<span style=\"color:#cc0000;\">The uploaded Image is too large.</span>");
            return;
        }
    }