Click here to Skip to main content
15,904,288 members
Home / Discussions / Web Development
   

Web Development

 
QuestionISAPI Extension nooB - .dll functions correctly if accessed directly but not through form POST ? Pin
Mike the Red6-Jul-09 1:06
Mike the Red6-Jul-09 1:06 
QuestionFont error .....! Pin
RongNK6-Jul-09 0:50
RongNK6-Jul-09 0:50 
AnswerRe: Font error .....! Pin
Vasudevan Deepak Kumar6-Jul-09 5:40
Vasudevan Deepak Kumar6-Jul-09 5:40 
Questionhow can i stream videos on my server Pin
ahmedhassan965-Jul-09 23:20
ahmedhassan965-Jul-09 23:20 
AnswerRe: how can i stream videos on my server Pin
Sabari MD13-Jul-09 18:22
Sabari MD13-Jul-09 18:22 
AnswerRe: how can i stream videos on my server Pin
dbkman1017-Jul-09 15:47
dbkman1017-Jul-09 15:47 
Questionproblem while uploading multiple files. Pin
techie815-Jul-09 2:16
techie815-Jul-09 2:16 
QuestionUnable to view generated thumbnail images. Pin
JimBob SquarePants4-Jul-09 3:51
JimBob SquarePants4-Jul-09 3:51 
Hi Folks,

I've recently experienced a major problem with a website I recently uploaded.
The problem is this......

I implemented a pretty standard thumbnail generation utility for uploaded images which works fine when tested on my local machine and also when I browse the website online from my local machine.

It doesn't work when I browse from other machines and also any thumbnails generated on the server when browsed from another machine do not show up on my machine!

I'm at a loss to explain this. Surely the code should be universal since it is processed by the server, not the local machine?

The only thing I can think of is that somehow the browser communicates with the server in a specific way based upon the installed framework that is on the browsing machine causing the server to run the code in a particular way. This goes against my understanding of the browser server relationship though.

My code is the following

<code>     
      ''' <summary>
      ''' Resizes images to the specified size.
      ''' </summary>
      ''' <param name="fileStream">The file stream.</param>
      ''' <param name="fileName">Name of the file.</param>
      ''' <param name="finalPath">Where to save the resized image</param>
      ''' <param name="maxWidth">Maximum Width</param>
      ''' <param name="maxHeight">Maximum Height</param>
      Public Shared Sub ResizeAndSave(ByVal fileStream As IO.FileStream, ByVal fileName As String, ByVal finalPath As String, ByVal maxWidth As Integer, ByVal maxHeight As Integer)
            Using originalBMP As New System.Drawing.Bitmap(fileStream)
                  ' Calculate the new image dimensions
                  Dim width As Integer = originalBMP.Width
                  'actual width
                  Dim height As Integer = originalBMP.Height
                  'actual height

                  'resize as landscape or portrait based on dimensions.
                  Dim tempWidth As Integer
                  If height > width Then
                        tempWidth = maxHeight
                        maxHeight = maxWidth
                        maxWidth = maxHeight
                  End If

                  Dim widthDiff As Integer = (width - maxWidth)
                  'how far off maxWidth?
                  Dim heightDiff As Integer = (height - maxHeight)
                  'how far off maxHeight?
                  'figure out which dimension is further outside the max size
                  Dim doWidthResize As Boolean = (maxWidth > 0 AndAlso width > maxWidth AndAlso widthDiff > -1 AndAlso (widthDiff > heightDiff OrElse maxHeight.Equals(0)))
                  Dim doHeightResize As Boolean = (maxHeight > 0 AndAlso height > maxHeight AndAlso heightDiff > -1 AndAlso (heightDiff > widthDiff OrElse maxWidth.Equals(0)))

                  'only resize if the image is bigger than the max or where image is square, and the diffs are the same
                  If doWidthResize OrElse doHeightResize OrElse (width.Equals(height) AndAlso widthDiff.Equals(heightDiff)) Then

                        Dim iStart As Integer
                        Dim divider As [Decimal]
                        If doWidthResize Then
                              iStart = width
                              divider = Math.Abs(CType(iStart, [Decimal]) / CType(maxWidth, [Decimal]))
                              width = maxWidth
                              height = CInt(Math.Round(CType((height / divider), [Decimal])))
                        Else
                              iStart = height
                              divider = Math.Abs(CType(iStart, [Decimal]) / CType(maxHeight, [Decimal]))
                              height = maxHeight
                              width = CInt(Math.Round(CType((width / divider), [Decimal])))
                        End If
                  End If

                  Using newBMP As New System.Drawing.Bitmap(originalBMP, width, height)
                        Using oGraphics As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(newBMP)
                              oGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
                              oGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
                              oGraphics.DrawImage(originalBMP, 0, 0, width, height)
                              newBMP.Save(String.Format("{0}{1}x{2}_{3}", finalPath, maxWidth, maxHeight, fileName))
                        End Using
                  End Using
            End Using
      End Sub
</code>

I'm seriously considering wiping my machine and reinstalling thye operating system, visual studio et al to see if there are bugs in my copy of the Net framework. I'm running a Release Candidate of Windows 7 (daft I know) so I wonder if that is the issue.

Any help would be greatly appreciated.

Thanks in advance

JimBob SquarePants
*******************************************************************
"He took everything personally, including our royalties!"
David St.Hubbins, Spinal Tap about Ian Faith, their ex-manager
*******************************************************************

AnswerRe: Cracking up! Pin
Not Active4-Jul-09 4:03
mentorNot Active4-Jul-09 4:03 
GeneralRe: Cracking up! Pin
JimBob SquarePants4-Jul-09 6:01
JimBob SquarePants4-Jul-09 6:01 
AnswerRe: Cracking up! Pin
molesworth4-Jul-09 4:59
molesworth4-Jul-09 4:59 
GeneralRe: Cracking up! Pin
JimBob SquarePants4-Jul-09 7:23
JimBob SquarePants4-Jul-09 7:23 
QuestionGame Developing Pin
ShahGopal3-Jul-09 19:14
ShahGopal3-Jul-09 19:14 
AnswerRe: Game Developing Pin
K03063-Jul-09 19:39
K03063-Jul-09 19:39 
Questionupload a website Pin
sheemap3-Jul-09 7:45
sheemap3-Jul-09 7:45 
AnswerRe: upload a website Pin
molesworth3-Jul-09 13:08
molesworth3-Jul-09 13:08 
GeneralRe: upload a website Pin
sheemap4-Jul-09 3:28
sheemap4-Jul-09 3:28 
QuestionJavaScript mounth Calendar Pin
shareef2220002-Jul-09 22:14
shareef2220002-Jul-09 22:14 
AnswerRe: JavaScript mounth Calendar Pin
Marc Firth2-Jul-09 22:27
Marc Firth2-Jul-09 22:27 
GeneralRe: JavaScript mounth Calendar Pin
shareef2220002-Jul-09 22:39
shareef2220002-Jul-09 22:39 
GeneralRe: JavaScript mounth Calendar Pin
Marc Firth2-Jul-09 22:44
Marc Firth2-Jul-09 22:44 
GeneralRe: JavaScript mounth Calendar Pin
shareef2220002-Jul-09 22:48
shareef2220002-Jul-09 22:48 
GeneralRe: JavaScript mounth Calendar Pin
Marc Firth3-Jul-09 0:11
Marc Firth3-Jul-09 0:11 
GeneralRe: JavaScript mounth Calendar Pin
Marc Firth3-Jul-09 0:16
Marc Firth3-Jul-09 0:16 
Question[Message Deleted] Pin
Member 40066482-Jul-09 20:45
Member 40066482-Jul-09 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.