示例#1
0
        private void addChineseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ImageHelper.AddImageSignPic(movieDate.ThumbPicPath, movieDate.ThumbPicPath, System.Environment.CurrentDirectory + @"\img\sub.png", 1, 100, 10);
            ImageHelper.AddImageSignPic(movieDate.PosterPicPath, movieDate.PosterPicPath, System.Environment.CurrentDirectory + @"\img\sub.png", 1, 100, 10);
            pictureBoxCover.LoadAsync(movieDate.ThumbPicPath);
            DirectoryInfo dir = new DirectoryInfo(movieDate.Path);

            FileInfo[] fileInfo = dir.GetFiles("*.nfo");
            foreach (FileInfo item in fileInfo)
            {
                XmlHelper.AddXmlChildNode(item.FullName, "tag", "中文字幕");
            }
        }
示例#2
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            if (fileUpload.HasFile && !string.IsNullOrEmpty(fileUpload.FileName))
            {
                FileInfo info = new FileInfo(fileUpload.FileName);
                try
                {
                    if (info != null)
                    {
                        UploadInfo uinfo = new UploadInfo(Guid.NewGuid());
                        uinfo.FileExtension = info.Extension;
                        fileUpload.SaveAs(uinfo.FileServerPath);

                        fileUpload.Visible      = false;
                        txtUploadResult.Visible = true;
                        txtUploadResult.Text    = uinfo.FileHttpPath;

                        if (autoCreateThumbnailImage)
                        {
                            UploadInfo uThumbnailinfo = new UploadInfo(Guid.NewGuid());
                            uThumbnailinfo.FileExtension = info.Extension;
                            ImageHelper.MakeThumbnailImage(uinfo.FileServerPath, uThumbnailinfo.FileServerPath,
                                                           maxWidth, maxHeight);

                            hiddenThumbnailImage.Text = uThumbnailinfo.FileHttpPath;
                        }
                        //addWaterMark
                        if (autoShowAddWaterMark && cbAddWaterMark.Checked)
                        {
                            UploadInfo waterremarkInfo = new UploadInfo(Guid.NewGuid());
                            waterremarkInfo.FileExtension = info.Extension;

                            ImageHelper.AddImageSignPic(System.Drawing.Image.FromFile(uinfo.FileServerPath),
                                                        waterremarkInfo.FileServerPath, ImageHelper.GetWaterMarkFilePath(), 9, 100, 90);
                            txtUploadResult.Text = waterremarkInfo.FileHttpPath;
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.Error("GetFileInfo Error", ex);
                    ShowInfo(ex.Message + ex.StackTrace);
                    //ShowInfo("上传文件信息错误");
                }
            }
            else
            {
                ShowInfo("请选择上传的文件");
            }
        }
示例#3
0
        private void CreateImage(string sourceimg, string savepath)
        {
            bool   noZoom = cbxNoZoom.Checked;
            string srcimg = sourceimg;
            int    n1     = sourceimg.LastIndexOf('.');

            string[] arr     = sourceimg.Split('\\');
            string   newpath = savepath.EndsWith("\\") ? savepath + arr.Last() : savepath + "\\" + arr.Last();
            int      n2      = newpath.LastIndexOf('.');


            if (cbkMark.Checked)
            {
                Image img       = Image.FromFile(sourceimg);
                Image watermark = Image.FromFile(_watermarkpath);
                int   positon   = Convert.ToInt32(txtPosition.Text);
                int   quality   = int.Parse(txtQuality.Text);
                int   trans     = int.Parse(txtTrans.Text);

                ImageHelper.AddImageSignPic(img, newpath, _watermarkpath, positon, quality, trans, _sizes, cboAddSize.Checked, _tail, cboAddIndex.Checked, noZoom);
            }
            else
            {
                int i = 1;
                foreach (int[] size in _sizes)
                {
                    string        newimg = "";
                    StringBuilder tail   = new StringBuilder();
                    if (cboAddSize.Checked)
                    {
                        tail.AppendFormat("_{0}x{1}", size[0], size[1]);
                    }
                    tail.AppendFormat(_tail);
                    if (cboAddIndex.Checked)
                    {
                        tail.Append(i);
                    }
                    newimg = newpath.Insert(n2, tail.ToString());
                    ImageHelper.GenThumbnail(srcimg, newimg, size[0], size[1], noZoom);
                    i++;
                }
            }
        }