سلام عليكم
اريد من الاخوة مساعدتي
اناا معي كود لكتابه ع صورة
ولكن اريد بعد كتابه ع صورة ان تتحول الي رابط تحميل مباشر
معي كود لتحويل صورة الي رابط مباشر بطريقة السحب والاسقاط
ولكن كل مااريده بعد الكتابه على صورة ان تتحول صورة الي رابط مباشر
كود للكتابه ع صورة
PHP كود :
Dim image As Image
Dim graphics As Graphics
Dim font As Font
Dim point As PointF
' Load image
image = Drawing.Image.FromFile("add.jpg")
' Create graphics from image
graphics = Drawing.Graphics.FromImage(image)
' Create font
font = New Font("Times New Roman", 80.0F)
' Create text position
point = New PointF(150, 150)
' Draw text
graphics.DrawString("emad", font, Brushes.White, point)
' Save image
image.Save("my_sample_output.jpg")
' Open generated image file in default image viewer installed in Windows
Process.Start("my_sample_output.jpg")
وهنا مشروع كامل لرفع صورة عن طريق سحب والاسقاط برابط مباشر
PHP كود :
Imports System.Net
Imports System.Text
Imports System.IO
Imports System.Text.RegularExpressions
Public Class Form1
Public Sub New()
InitializeComponent()
Control.CheckForIllegalCrossThreadCalls = False
End Sub
Dim ClientId As String = "66665db7b4b0608"
Dim Dictionner As New Dictionary(Of WebClient, ListViewItem)
Private Sub Completed(sender As Object, e As UploadValuesCompletedEventArgs)
Dim Result As String = (New UTF8Encoding).GetString(e.Result)
If e.Cancelled = True Then
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).ForeColor = Color.RoyalBlue
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).Text = "Cancelled"
ElseIf e.Error IsNot Nothing Then
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).ForeColor = Color.Red
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).Text = "Error"
ElseIf e.Result IsNot Nothing Then
Dim K As Match = Regex.Match(Result, ",""link"":""(.*?)""}")
lvfiles.Items(Dictionner.Item(sender).Index).ToolTipText = K.Groups(1).Value.Replace("\", "")
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).ForeColor = Color.Green
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).Text = "Sucessfully, Uploaded"
End If
End Sub
Private Sub Progress(sender As Object, e As UploadProgressChangedEventArgs)
On Error Resume Next
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).ForeColor = Color.Blue
lvfiles.Items(Dictionner.Item(sender).Index).SubItems(1).Text = e.ProgressPercentage & "%"
End Sub
Private Sub lvfiles_DoubleClick(sender As Object, e As EventArgs) Handles lvfiles.DoubleClick
If Not lvfiles.FocusedItem.SubItems(1).ForeColor = Color.Green Then : Exit Sub : End If
Clipboard.SetText(lvfiles.FocusedItem.ToolTipText, TextDataFormat.Text)
TextBox1.Text = (lvfiles.FocusedItem.ToolTipText)
MsgBox("Link Copied", MsgBoxStyle.Information)
End Sub
Private Sub lvfiles_DragDrop(sender As Object, e As DragEventArgs) Handles lvfiles.DragDrop
Try
Dim FilePath As String = e.Data.GetData(DataFormats.FileDrop)(0)
Dim NIcon As Icon = Icon.ExtractAssociatedIcon(FilePath)
ImageList1.Images.Add(NIcon)
Dim itm As New ListViewItem
itm.UseItemStyleForSubItems = False
itm.Text = Path.GetFileName(FilePath)
itm.SubItems.Add("Uploading...").ForeColor = ColorTranslator.FromHtml("#3b4451")
itm.ImageIndex = ImageList1.Images.Count - 1
lvfiles.Items.Add(itm)
Dim w As New WebClient()
w.Headers.Add("Authorization", "Client-ID " & ClientId)
AddHandler w.UploadValuesCompleted, AddressOf Completed
AddHandler w.UploadProgressChanged, AddressOf Progress
Dim Keys As New System.Collections.Specialized.NameValueCollection
Keys.Add("image", Convert.ToBase64String(File.ReadAllBytes(FilePath)))
w.UploadValuesAsync(New Uri("https://api.imgur.com/3/image"), Keys)
Dictionner.Add(w, itm)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub lvfiles_DragEnter(sender As Object, e As DragEventArgs) Handles lvfiles.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.All
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub lvfiles_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lvfiles.SelectedIndexChanged
End Sub
End Class
اريد فقط تحويل صورة المكتوبه لرابط مباشر وشكرا