Changeset 11890 for extensions/PiwigoLib/TestPiwigoLib
- Timestamp:
- Aug 2, 2011, 4:50:49 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/PiwigoLib/TestPiwigoLib/Form1.cs
r11872 r11890 46 46 //List<PwgTag> lstTag = PwgServiceProvider.Instance.PwgTagsService.GetAdminListOfTag(); 47 47 48 //Int32 Page = 0;49 //Int32 PerPage = 0;50 //Int32 Count = 0;48 Int32 Page = 0; 49 Int32 PerPage = 0; 50 Int32 Count = 0; 51 51 52 //List<PwgImage> lstImgTag = PwgServiceProvider.Instance.PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 },53 //null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,54 //ref Page, ref PerPage, ref Count);52 List<PwgImage> lstImgTag = PwgServiceProvider.Instance.PwgTagsService.GetListOfImagesFormTags(new List<Int32>() { 1, 7 }, 53 null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 54 ref Page, ref PerPage, ref Count); 55 55 56 //List<PwgImage> lstImgCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfImagesFormCategory(1,57 //null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,58 //ref Page, ref PerPage, ref Count);56 List<PwgImage> lstImgCat = PwgServiceProvider.Instance.PwgCategoriesService.GetListOfImagesFormCategory(1, 57 null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 58 ref Page, ref PerPage, ref Count); 59 59 60 60 //Console.WriteLine("lstImg : Page " + Page.ToString() + " PerPage " + PerPage); … … 74 74 //lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetAdminListOfCategory(); 75 75 76 //FileInfo fi = new FileInfo("C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n.jpg"); 77 //PwgImageAdded imgAdd = PwgServiceProvider.Instance.PwgImagesService.addImageByMultiPartForm(fi, null, 1, "benoit", "byarl", "test upload", 0, new List<PwgTag>() { new PwgTag() { Name = "Benoit" }, new PwgTag() { Name = "Noé" } }); 76 FileInfo fiBig = new FileInfo("C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n.jpg"); 77 FileInfo fiThumb = new FileInfo(MakeThumb(fiBig,"C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_thum.jpg",64)); 78 FileInfo fiLow = new FileInfo(MakeThumb(fiBig,"C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_low.jpg",256)); 78 79 79 rc = PwgServiceProvider.Instance.PwgImagesService.DeleteImage(319, sess.SecurityToken); 80 //PwgImageAdded imgAdd = PwgServiceProvider.Instance.PwgImagesService.addImageByMultiPartForm(fiBig, null, 1, "benoit", "byarl", "test upload", 0, new List<PwgTag>() { new PwgTag() { Name = "Benoit" }, new PwgTag() { Name = "Noé" } }); 81 rc = PwgServiceProvider.Instance.PwgImagesService.addImage(fiBig, fiLow, fiThumb, "Benoit", "bayral", DateTime.Now, "demo", null, null, PwgConfidentLevelEnum.All); 82 //rc = PwgServiceProvider.Instance.PwgImagesService.DeleteImage(319, sess.SecurityToken); 80 83 81 PwgImageInfo info = PwgServiceProvider.Instance.PwgImagesService.getImageInfo(319, null, null);82 84 //PwgImageInfo info = PwgServiceProvider.Instance.PwgImagesService.getImageInfo(imgAdd.Id, null, null); 85 83 86 //PwgImageRate imgRate = PwgServiceProvider.Instance.PwgImagesService.RateImage(1, 5); 84 87 … … 93 96 } 94 97 98 private string MakeThumb(FileInfo fi, String ext, int size) 99 { 100 // create an image object, using the filename we just retrieved 101 System.Drawing.Image image = System.Drawing.Image.FromFile(fi.FullName); 102 103 // create the actual thumbnail image 104 System.Drawing.Image thumbnailImage = image.GetThumbnailImage(size, size, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero); 105 106 // make a memory stream to work with the image bytes 107 FileStream imageStream = new FileStream(ext, FileMode.OpenOrCreate); 108 109 // put the image into the memory stream 110 thumbnailImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg); 111 112 imageStream.Close(); 113 return ext; 114 } 115 116 /// <summary> 117 /// Required, but not used 118 /// </summary> 119 /// <returns>true</returns> 120 public bool ThumbnailCallback() 121 { 122 return true; 123 } 124 125 95 126 private void Form1_FormClosing(object sender, FormClosingEventArgs e) 96 127 {
Note: See TracChangeset
for help on using the changeset viewer.