Line 1: #ExternalChecksum("D:\Websites\megabusa\photos\photo.aspx","{ff1816ec-aa5e-4d10-87f7-6f4963833460}","E4E9B0A2C3F60C35AC7C4F9A21EC55313AB67EA4")
Line 2: '------------------------------------------------------------------------------
Line 3: ' <auto-generated>
Line 4: ' This code was generated by a tool.
Line 5: ' Runtime Version:4.0.30319.42000
Line 6: '
Line 7: ' Changes to this file may cause incorrect behavior and will be lost if
Line 8: ' the code is regenerated.
Line 9: ' </auto-generated>
Line 10: '------------------------------------------------------------------------------
Line 11:
Line 12: Option Strict Off
Line 13: Option Explicit On
Line 14:
Line 15: Imports Microsoft.VisualBasic
Line 16: Imports System
Line 17: Imports System.Collections
Line 18: Imports System.Collections.Generic
Line 19: Imports System.Collections.Specialized
Line 20: Imports System.ComponentModel.DataAnnotations
Line 21: Imports System.Configuration
Line 22: Imports System.Data
Line 23: Imports system.drawing
Line 24: Imports system.drawing.drawing2d
Line 25: Imports system.io
Line 26: Imports System.Linq
Line 27: Imports system.math
Line 28: Imports System.Net
Line 29: Imports System.Net.Mail
Line 30: Imports System.Text
Line 31: Imports System.Text.RegularExpressions
Line 32: Imports System.Web
Line 33: Imports System.Web.Caching
Line 34: Imports System.Web.DynamicData
Line 35: Imports system.web.httputility
Line 36: Imports System.Web.Profile
Line 37: Imports System.Web.Security
Line 38: Imports System.Web.SessionState
Line 39: Imports System.Web.UI
Line 40: Imports System.Web.UI.HtmlControls
Line 41: Imports System.Web.UI.WebControls
Line 42: Imports System.Web.UI.WebControls.WebParts
Line 43: Imports System.Xml.Linq
Line 44: Imports Virtusales.Biblio.ResourceServer
Line 45:
Line 46: Namespace ASP
Line 47:
Line 48: <System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()> _
Line 49: Public Class photos_photo_aspx
Line 50: Inherits Global.System.Web.UI.Page
Line 51: Implements System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler
Line 52:
Line 53: Private Shared __initialized As Boolean
Line 54:
Line 55: Private Shared __fileDependencies As Object
Line 56:
Line 57:
Line 58: #ExternalSource("D:\Websites\megabusa\photos\functions.inc",1)
Line 59: function gethover(fn as string) as string
Line 60: dim Temp as string
Line 61: dim bytes as double = new fileinfo(fn).length
Line 62: if bytes>1024*1024 then
Line 63: temp=formatnumber(bytes/1024/1024,1) & " mb"
Line 64: elseif bytes>1024 then
Line 65: temp=formatnumber(bytes/1024,0) & " kb"
Line 66: else
Line 67: temp=formatnumber(bytes,0) & " bytes"
Line 68: end if
Line 69: return temp
Line 70: end function
Line 71:
Line 72:
Line 73: sub ProcessImage(This as string,Folder as string,Clean as string,Width as integer,Height as integer,Cat as string,optional Force as boolean=false,optional StampVideo as boolean=false)
Line 74: dim fullpath as string
Line 75: dim m as virtusales.biblio.resourceserver.memimage
Line 76:
Line 77: folder=server.mappath("gallery") & "\" & folder & "\" & cat
Line 78:
Line 79: if not directory.exists(folder) then
Line 80: directory.createdirectory(folder)
Line 81: end if
Line 82:
Line 83: fullpath=folder & "\" & clean & ".jpg"
Line 84: if not file.exists( fullpath ) or force then
Line 85:
Line 86: 'response.write("First time processing " & this & " " & cat & "...<BR>" & vbcrlf)
Line 87: 'response.flush
Line 88: try
Line 89: m=new memimage(this)
Line 90: m.setbounds(width,height,72)
Line 91:
Line 92: if stampvideo then
Line 93: const Text as string="VIDEO"
Line 94:
Line 95: dim debugtext as string="Draft Debug" & vbcrlf
Line 96: dim Angle as integer=45
Line 97: dim g as Graphics = m.GetGraphics
Line 98: dim Font as Font
Line 99: dim TextSize as SizeF
Line 100: dim Hypo as integer=sqrt ( ((m.Height/2)^2) + ((m.Width/2)^2) )
Line 101: dim Fontsize as integer
Line 102: dim XPos as integer
Line 103: dim YPos as integer
Line 104:
Line 105: debugtext &= "Img height=" & m.height & vbcrlf
Line 106: debugtext &= "Img width=" & m.width & vbcrlf
Line 107: debugtext &= "Hypo=" & hypo & vbcrlf
Line 108:
Line 109: '### Calculate the font size to be 60% of Hypo
Line 110: for FontSize=500 to 1 step -1
Line 111: Font=new Font( "Arial", FontSize , fontstyle.bold )
Line 112: Textsize=g.Measurestring(text,font)
Line 113: if textsize.width<(hypo*.60) then
Line 114: exit for
Line 115: end if
Line 116: next
Line 117:
Line 118: debugtext &= "Font Size=" & fontsize & vbcrlf
Line 119: debugtext &= "Text Width=" & textsize.width & vbcrlf
Line 120: debugtext &= "Text Height=" & textsize.height & vbcrlf
Line 121:
Line 122: dim DiagTextSize as integer = sqrt ( (textsize.width^2)/2 )
Line 123: debugtext &= "Text Diag=" & diagtextsize & vbcrlf
Line 124:
Line 125: '### Get X and Y plotting Positions -- FROM THE CENTRE
Line 126: xpos=-textsize.width/2
Line 127: ypos=-textsize.height/2
Line 128: debugtext &= "XPOS=" & xpos & vbcrlf
Line 129: debugtext &= "YPOS=" & ypos & vbcrlf
Line 130:
Line 131: '### Set Up Graphics
Line 132: g.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias
Line 133:
Line 134: dim TextBorder as integer = m.height/15
Line 135:
Line 136: '### Rotation
Line 137: dim Matrix as new Matrix
Line 138: matrix.translate( m.width - (diagtextsize/2) - textborder , m.height - (diagtextsize/2) - textborder )
Line 139: 'matrix.translate(m.width/2,m.height/2)
Line 140: Matrix.RotateAt( -angle , new pointf( 0,0 ))
Line 141: g.MultiplyTransform(Matrix)
Line 142:
Line 143: '### Stamp all around the main text
Line 144: dim Stroke as integer=((textsize.height/100)+0.5)
Line 145:
Line 146: g.drawString( text, Font, Brushes.White, xpos-stroke, ypos-stroke )
Line 147: g.drawString( text, Font, Brushes.White, xpos+stroke, ypos-stroke )
Line 148: g.drawString( text, Font, Brushes.White, xpos-stroke, ypos+stroke )
Line 149: g.drawString( text, Font, Brushes.White, xpos+stroke, ypos+stroke )
Line 150:
Line 151: '### Stamp the main text
Line 152: g.drawString( text, Font, Brushes.Black, xpos, ypos )
Line 153:
Line 154: ' Kill objects
Line 155: g.dispose( )
Line 156:
Line 157: end if
Line 158:
Line 159: m.save(fullpath,"jpg")
Line 160: m.dispose
Line 161: catch
Line 162: end try
Line 163: end if
Line 164:
Line 165: end sub
Line 166:
Line 167:
Line 168: sub ProcessImages(This as string,Folder as string,Clean as string,optional Force as boolean=false)
Line 169: server.scripttimeout=30000
Line 170:
Line 171: dim StampVideo as boolean = isValidVideo(This)
Line 172: 'if isValidVideo(This) then
Line 173: ' this=server.mappath(".") & "\video.jpg"
Line 174: 'end if
Line 175:
Line 176: if isValidFile(This) then
Line 177: processImage(this,folder,clean,50,38,"tiny",force,stampvideo)
Line 178: processImage(this,folder,clean,200,200,"thumbs",force,stampvideo)
Line 179: processImage(this,folder,clean,600,600,"small",force,stampvideo)
Line 180: end if
Line 181: end sub
Line 182:
Line 183:
Line 184: function Title(Text as string)
Line 185: return "<font size=3 face=arial><b><i>" & text & "</i></b></font>"
Line 186: end function
Line 187:
Line 188:
Line 189: function isValidImage(This as string) as boolean
Line 190: return this.indexof("._")=-1 and this.tolower.indexof("thumbs.db")=-1 and ( this.tolower.endswith("jpg") or this.tolower.endswith("gif") or this.tolower.endswith("tif") or this.tolower.endswith("bmp") )
Line 191: end function
Line 192: function isValidVideo(This as string) as boolean
Line 193: return this.indexof("._")=-1 and this.tolower.indexof("thumbs.db")=-1 and ( this.tolower.endswith("mpg") or this.tolower.endswith("avi") )
Line 194: end function
Line 195: function isValidFile(This as string) as boolean
Line 196: return isValidVideo(this) or isValidImage(This)
Line 197: end function
Line 198:
Line 199:
Line 200: function cleanup(txt as string) as string
Line 201: return txt.substring(txt.lastindexof("\")+1)
Line 202: end function
Line 203: #End ExternalSource
Line 204:
Line 205:
Line 206: #ExternalSource("D:\Websites\megabusa\photos\photo.aspx",9)
Line 207:
Line 208:
Line 209: sub page_load(Src As Object, E As EventArgs)
Line 210:
Line 211: if file.exists(server.mappath("gallery") & "\" & request("folder") & "\thumbs.db") then file.delete(server.mappath("gallery") & "\" & request("folder") & "\thumbs.db")
Line 212: dim files() as string = directory.getfiles(server.mappath("gallery") & "\" & request("folder"))
Line 213: dim counter as integer
Line 214: dim photonum as integer
Line 215: dim newfile as string
Line 216: dim maxphotos = ubound(files)
Line 217: dim theaction = request("action")
Line 218: for counter=0 to maxphotos
Line 219: if cleanup(files(counter)).tolower=request("file").tolower then
Line 220: photonum=counter
Line 221: end if
Line 222: next
Line 223:
Line 224: select case theaction
Line 225: case "400","640","1000"
Line 226: dim path as string = server.mappath("gallery") & "\" & request("folder") & "\" & request("file")
Line 227: dim m as memimage = new memimage( path )
Line 228: m.quality=100
Line 229: m.setbounds(theaction,theaction,72)
Line 230: response.contenttype="image/jpeg"
Line 231: response.binarywrite(m.getbinary("jpg"))
Line 232:
Line 233: case "90","180","270"
Line 234: dim path as string = server.mappath("gallery") & "\" & request("folder") & "\" & request("file")
Line 235: dim m as memimage = new memimage( path )
Line 236: dim clean as string=request("file")
Line 237: clean=clean.substring(0,clean.lastindexof("."))
Line 238: m.quality=100
Line 239: m.rotate(request("action"))
Line 240: m.save(path,"jpg")
Line 241: m.dispose
Line 242: ProcessImages(path,request("folder"),clean,true)
Line 243:
Line 244: case "trash"
Line 245: dim path as string = server.mappath("gallery") & "\" & request("folder") & "\" & request("file")
Line 246: file.copy(path,server.mappath("trash") & "\" & request("file"))
Line 247: file.delete(path)
Line 248: theaction = "next"
Line 249: end select
Line 250:
Line 251: select case theaction
Line 252:
Line 253: case "prev","next"
Line 254: if request("action")="prev" then
Line 255: if photonum=0 then
Line 256: newfile=cleanup(files(ubound(files)))
Line 257: else
Line 258: newfile=cleanup(files(photonum-1))
Line 259: end if
Line 260: else
Line 261: if photonum=maxphotos then
Line 262: newfile=cleanup(files(0))
Line 263: else
Line 264: newfile=cleanup(files(photonum+1))
Line 265: end if
Line 266: end if
Line 267:
Line 268: response.redirect("photo.aspx?back=" & request("back") & "&folder=" & urlencode(request("folder")) & "&file=" & urlencode(newfile))
Line 269: case "back"
Line 270: response.redirect("gallery.aspx?back=" & request("back") & "&folder=" & urlencode(request("folder")))
Line 271: end select
Line 272:
Line 273: response.write(title(request("folder") & " - " & request("file").substring(0,request("file").length-4)))
Line 274: response.write("<BR>")
Line 275:
Line 276: if request("file").tolower.endswith("jpg") or request("file").tolower.endswith("tif") then
Line 277: response.write("<a href=""gallery/" & htmlencode(request("folder")) & "/" & htmlencode(request("file")) & """>")
Line 278: response.write("<img src=""gallery/" & htmlencode(request("folder")) & "/small/" & request("file") & "?timer=" & microsoft.visualbasic.timer & """ border=0>")
Line 279: response.write("</a>")
Line 280: else
Line 281: dim aburl as string = request.url.getleftpart(uripartial.path)
Line 282: aburl=aburl.substring(0,aburl.lastindexof("/")) & "/gallery/" & htmlencode(request("folder")) & "/" & request("file")
Line 283:
Line 284: response.write("<OBJECT ID=""MediaPlayer"" width=640 height=540")
Line 285: response.write(" classid=""CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95""")
Line 286: response.write(" codebase=""http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=,1,52,701""")
Line 287: response.write(" standby=""Loading Microsoft Windows Media Player components...""")
Line 288: response.write(" type=""application/x-oleobject"">")
Line 289:
Line 290: response.write("<PARAM name=""FileName"" value=""" & aburl & """>")
Line 291: response.write("<PARAM NAME=""animationatStart"" VALUE=""true"">")
Line 292: response.write("<PARAM NAME=""transparentatStart"" VALUE=""true"">")
Line 293: response.write("<PARAM NAME=""autoStart"" VALUE=""true"">")
Line 294: response.write("<PARAM NAME=""showControls"" VALUE=""true"">")
Line 295:
Line 296: response.write("<EMBED type=""application/x-mplayer2""")
Line 297: response.write(" pluginspage=""http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/""")
Line 298: response.write(" SRC=""" & aburl & """")
Line 299: response.write(" name=""MediaPlayer""")
Line 300: response.write(" width=320")
Line 301: response.write(" height=240>")
Line 302: response.write("</EMBED>")
Line 303: response.write("</OBJECT>")
Line 304:
Line 305: '### microsoft mp 11 sdk method
Line 306: 'response.write("<OBJECT id = ""Player"" width=600 height=440")
Line 307: 'response.write(" CLASSID = ""CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"">")
Line 308: 'response.write("<PARAM Name = ""autoStart"" Value = ""true"">")
Line 309: 'response.write("<PARAM Name = ""uiMode"" Value = ""full"">")
Line 310: 'response.write("<PARAM Name = ""url"" Value = """ & aburl & """>")
Line 311: 'response.write("</OBJECT>")
Line 312:
Line 313: '###old and simple way
Line 314: 'response.write("<img dynsrc=""gallery/" & htmlencode(request("folder")) & "/" & request("file") & """ border=0 width=600 height=400>")
Line 315: end if
Line 316: response.write("<BR>")
Line 317:
Line 318: action("back","Back")
Line 319:
Line 320: if request("back")="1" then
Line 321: response.write(" ")
Line 322: action("90","Rotate 90")
Line 323: action("180","Rotate 180")
Line 324: action("270","Rotate 270")
Line 325: action("trash","Trash")
Line 326: end if
Line 327:
Line 328: response.write(" ")
Line 329: action("prev","Prev")
Line 330: response.write("<font face=arial size=2> " & photonum+1 & " of " & maxphotos+1 & " ")
Line 331: action("next","Next")
Line 332:
Line 333: if request("back")="1" then
Line 334: action("400","400wide")
Line 335: action("640","640wide")
Line 336: action("1000","1000wide")
Line 337: end if
Line 338:
Line 339: end sub
Line 340:
Line 341: sub Action(Act as string,Text as string)
Line 342: button("photo.aspx?back=" & request("back") & "&action=" & act & "&folder=" & htmlencode(replace(urlencode(Request("folder")),"'","\'")) & "&file=" & replace(htmlencode(urlencode(request("file"))),"'","\'"),text)
Line 343: end sub
Line 344:
Line 345: sub Button(URL as string,Text as string)
Line 346: response.write("<button onClick=""document.location.href='" & url & "'"">" & text & "</button>")
Line 347: end sub
Line 348:
Line 349:
Line 350: #End ExternalSource
Line 351:
Line 352:
Line 353: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Line 354: Public Sub New()
Line 355: MyBase.New
Line 356: Dim dependencies() As String
Line 357: CType(Me,Global.System.Web.UI.Page).AppRelativeVirtualPath = "~/photos/photo.aspx"
Line 358: If (Global.ASP.photos_photo_aspx.__initialized = false) Then
Line 359: dependencies = New String(1) {}
Line 360: dependencies(0) = "~/photos/photo.aspx"
Line 361: dependencies(1) = "~/photos/functions.inc"
Line 362: Global.ASP.photos_photo_aspx.__fileDependencies = Me.GetWrappedFileDependencies(dependencies)
Line 363: Global.ASP.photos_photo_aspx.__initialized = true
Line 364: End If
Line 365: Me.Server.ScriptTimeout = 30000000
Line 366: End Sub
Line 367:
Line 368: Protected ReadOnly Property Profile() As System.Web.Profile.DefaultProfile
Line 369: Get
Line 370: Return CType(Me.Context.Profile,System.Web.Profile.DefaultProfile)
Line 371: End Get
Line 372: End Property
Line 373:
Line 374: Protected ReadOnly Property ApplicationInstance() As System.Web.HttpApplication
Line 375: Get
Line 376: Return CType(Me.Context.ApplicationInstance,System.Web.HttpApplication)
Line 377: End Get
Line 378: End Property
Line 379:
Line 380: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Line 381: Private Sub __BuildControlTree(ByVal __ctrl As photos_photo_aspx)
Line 382:
Line 383: #ExternalSource("D:\Websites\megabusa\photos\photo.aspx",1)
Line 384: Me.InitializeCulture
Line 385:
Line 386: #End ExternalSource
Line 387: End Sub
Line 388:
Line 389: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Line 390: Protected Overrides Sub FrameworkInitialize()
Line 391: MyBase.FrameworkInitialize
Line 392: Me.__BuildControlTree(Me)
Line 393: Me.AddWrappedFileDependencies(Global.ASP.photos_photo_aspx.__fileDependencies)
Line 394: Me.Request.ValidateInput
Line 395: End Sub
Line 396:
Line 397: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Line 398: Public Overrides Function GetTypeHashCode() As Integer
Line 399: Return 5381
Line 400: End Function
Line 401:
Line 402: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Line 403: Public Overrides Sub ProcessRequest(ByVal context As System.Web.HttpContext)
Line 404: MyBase.ProcessRequest(context)
Line 405: End Sub
Line 406: End Class
Line 407: End Namespace
Line 408:
|