 |
|
 |
How declare or create a Thumbnail in Asp.net.I will confuse help me
|
|
|
|
 |
|
 |
You have uploaded brilliant example for asp.net but i have a question that i wan't to store this images in database using mssql, mysql or msaccess. please reply me at potdarm@rocketmail.com
Thanking You
Regards
Mukund
|
|
|
|
 |
|
 |
First time i try it, it works! Thank you co much Chris Khoo!
|
|
|
|
 |
|
|
 |
|
 |
Please translate the above article from C# to VB, please
N.T
|
|
|
|
 |
|
 |
Hi,
Your article is awesome no doubt. When I use it, works fine but I noticed my thumbnail KBs more than original image.
I think thumbnail image should be less KBs.
Please help.
Regards
Seema
|
|
|
|
 |
|
 |
Excellent and worked without trouble
|
|
|
|
 |
|
|
 |
|
 |
example: png,gif,...?
Thanks.
|
|
|
|
 |
|
 |
Just had to change 1st line of .aspx page as follows
<%@ Page language="c#" AutoEventWireup="false" Inherits="netimageupload.upload" CodeFile="upload.aspx.cs" %>". And then the error is gone.
Rest is fine.
Thanks for the code.
|
|
|
|
 |
|
 |
Seems like this script has been around the block. Still pretty high-speed and low-drag. It has my medium sized images uploaded with thumbnail created in less than two seconds into a shared hosting environment with awful bandwidth. I'm gonna see if I can make it create two images. One thumb and one regular so that my clients can upload any size. Thanks for the script.
BTW, I shoulda looked here first. Way to go Codeproject.
|
|
|
|
 |
|
|
 |
|
 |
Message Automatically Removed
|
|
|
|
 |
|
 |
arvinder_aneja wrote: if u r uploading the same image again and again dat wud be worst, wen u wud have duplicate images nd dat wud make d application heavy is well..
It seems to me that you are an utter moron. You are using a computer, not a mobile phone. When I say 'don't speak like a retard', and I talking about non words like dat, wud, wen, etc.
In addition, you have been told over and over in the quick answers forum to mark your questions as ASP.NET and you do not. Perhaps you are just too stupid for software development ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
 |
|
 |
Message Automatically Removed
|
|
|
|
 |
|
 |
arvinder_aneja wrote: yes i am not perfect for software devolpment yet..
but i know how to talk politely with others as long as they are nice wid me..
but stupid people like you should be learnt a lesson..
i think u got an ugly mind like ur face...
so jus try to speak politely with others.. or peeps will kick ur dumb ass...
so MR christian Graus in short DUMB ASS... i do nt want to waste my time bcuz i have many things to learn..
and i will try hard no matter how many idiots like you wud come in ma way..
so fukkkkkkkk offffffff.
I see - you actually cannot spell at all. I thought it was just txt speak. I apologise. Perhaps you should learn English, so you can deal with your Rentacoder clients.
You think some one votes on my articles is a 'lesson' to me ? I don't care at all. I put them out there, and those articles made me more money than you and your family will see in a lifetime. Their job is done. Your one votes actually made me laugh my head off. You are an incompetent fool who hopes to write code, and you're attacking the people who try to help you. That's brilliant. You're a smart guy.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
 |
|
 |
Haha, thanks for quoting what was bound to be an automatically removed post; I've had my good laugh for the day.
Christian Graus wrote: those articles made me more money than you and your family will see in a lifetime
Out of curiousity, did you directly earn money by writing your articles, or do you mean that they looked nice on the resume and so indirectly got you more money by getting you better paying jobs?
|
|
|
|
 |
|
 |
You would do well to try a little harder not to be a complete penile gland on this site, especially to the guy with the highest reputation (by a wide margin). He got that reputation by helping people with their questions. If he gives you advice regarding your messages, you can pretty much bet that it's going to be good advice.
I recommend that you go back and honestly re-vote those articles. Otherwise, your votes will be deleted, thus making your little rebellion about as effectual as a kickstand on a Sherman tank.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
 |
|
 |
Error 1 'System.Web.UI.HtmlControls.HtmlImage' does not contain a definition for 'ImageUrl' and no extension method 'ImageUrl' accepting a first argument of type 'System.Web.UI.HtmlControls.HtmlImage' could be found (are you missing a using directive or an assembly reference?) C:\Users\cmmaung\Desktop\ExamTest\Test 2\WebApplication1\WebApplication1\Default.aspx.cs 107 32 WebApplication1
|
|
|
|
 |
|
 |
<%@ Page language="c#" Codebehind="upload.aspx.cs" AutoEventWireup="false" Inherits="netimageupload.WebForm1" %>
Inherits="netimageupload.WebForm1"
shows an error ...... "Could not load type 'WebForm1'"
|
|
|
|
 |
|
 |
im getting an error like this 'imgPicture' does not contain a definition for 'ImageUrl' in the line imgPicture.ImageUrl = sSavePath + sThumbFile;
plz help
|
|
|
|
 |
|
 |
sSavePath = "images/";
to
sSavePath = "";
over all-ly Good effort
|
|
|
|
 |
|
 |
Why? Surely you must say more for your comment. Would you add another step in the process?
|
|
|
|
 |
|
 |
I have converted the code to vb it works good for me even though it is a strict conversion if anyone else needed it in vb here it is
Protected Sub btnUpload_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpload.Click
'// Initialize variables
Dim sSavePath As String 'string sSavePath;
Dim sThumbExtension As String 'string sThumbExtension;
Dim intThumbWidth As Integer 'int intThumbWidth;
Dim intThumbHeight As Integer 'int intThumbHeight;
' // Set constant values
sSavePath = "images/" ';
sThumbExtension = "_thumb" ';
intThumbWidth = 160 ';
intThumbHeight = 120 ';
'// If file field isn�t empty
If (Not filUpload.PostedFile Is Nothing) Then
'{
'// Check file size (mustn�t be 0)
Dim myFile As HttpPostedFile
myFile = filUpload.PostedFile ';
Dim nFileLen As Integer = myFile.ContentLength 'int nFileLen = myFile.ContentLength;
If nFileLen = 0 Then
'{
lblOutput.Text = "No file was uploaded." ';
Return ';
End If '}
'// Check file extension (must be JPG)
If (Not System.IO.Path.GetExtension(myFile.FileName).ToLower() = ".jpg") Then
'{
lblOutput.Text = "The file must have an extension of JPG" ';
Return ';
End If '}
'// Read file into a data stream
Dim myData() As Byte = New Byte(nFileLen) {} 'byte[] myData = new Byte[nFileLen];
myFile.InputStream.Read(myData, 0, nFileLen) ';
' // Make sure a duplicate file doesn�t exist. If it does, keep on appending an
'// incremental numeric until it is unique
Dim sFilename As String = System.IO.Path.GetFileName(myFile.FileName) 'string sFilename = System.IO.Path.GetFileName(myFile.FileName);
Dim file_append As Integer = 0 ' int file_append = 0;
While (System.IO.File.Exists(Server.MapPath(sSavePath + sFilename)))
'{
file_append += 1 ';
sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & file_append.ToString() & ".jpg" ';
' }
End While
'// Save the stream to disk
Dim newFile As System.IO.FileStream
newFile = New System.IO.FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create) ';
newFile.Write(myData, 0, myData.Length) ';
newFile.Close() ';
'// Check whether the file is really a JPEG by opening it
Dim myCallBack As System.Drawing.Image.GetThumbnailImageAbort 'System.Drawing.Image.GetThumbnailImageAbort myCallBack =
myCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback) ';
Dim myBitmap As Drawing.Bitmap ' Bitmap myBitmap;
Try
'{
myBitmap = New Drawing.Bitmap(Server.MapPath(sSavePath + sFilename)) ';
'// If jpg file is a jpeg, create a thumbnail filename that is unique.
file_append = 0 ';
Dim sThumbFile As String = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & sThumbExtension & ".jpg"
' ; 'string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
'+ sThumbExtension + ".jpg";
While (System.IO.File.Exists(Server.MapPath(sSavePath + sThumbFile)))
'{
file_append += 1 ';
sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) & file_append.ToString() & sThumbExtension & ".jpg" ';
End While '}
'// Save thumbnail and output it onto the webpage
Dim myThumbnail As System.Drawing.Image
myThumbnail = myBitmap.GetThumbnailImage(intThumbWidth, intThumbHeight, myCallBack, IntPtr.Zero) ';
myThumbnail.Save(Server.MapPath(sSavePath + sThumbFile)) ';
imgPicture.ImageUrl = sSavePath + sThumbFile ';
'// Displaying success information
lblOutput.Text = "File uploaded successfully!" ';
'// Destroy objects
myThumbnail.Dispose() ';
myBitmap.Dispose() ';
'}
Catch errArgument As ArgumentException
'{
' // The file wasn't a valid jpg file
lblOutput.Text = "The file wasn't a valid jpg file." ';
System.IO.File.Delete(Server.MapPath(sSavePath + sFilename)) ';
End Try '}
End If'}
'}
End Sub
Public Function ThumbnailCallback() As Boolean
'{
Return False ';
'}
End Function
|
|
|
|
 |
|
 |
Thanks bcalvin. Saved me a lot of faffing about did that.
|
|
|
|
 |