"
" referring to the line "
" below.
If I replace the variable: iwid with a physical integer like 35, it works! Of course this is not an option given the dynamic requirements of this variable.
Any help on this would be Super!
Chris
"Illegitimis non carborundum"
(don't let the b@st@rds get you down)
Code:
BC30519: Overload resolution failed because no accessible 'New' can be called without a narrowing conversion
Code:
Dim tb as New System.Drawing.Bitmap(iwid, iHt, PixelFormat.Format24BPPRGB)
If I replace the variable: iwid with a physical integer like 35, it works! Of course this is not an option given the dynamic requirements of this variable.
Code:
sub Make_Thumbnail()
'load the source if it is photo 1 and make a thumbnail
Dim iwid 'the width of the thumbnail
Dim unit = GraphicsUnit.Pixel ' Set a unit of measurement as pixel, could have used Inch, Point, etc
if(System.IO.File.Exists("C:\myfolder\test_1.jpg")) = true then
Dim ti as System.Drawing.Image
ti = System.Drawing.Image.FromFile("C:\myfolder\test_1.jpg")
const iHt = 35 'the height of all thumnails/icons
iwid = (cInt((iHt * 100) / (ti.height)))
iwid = (cInt(((iwid * ti.width) / 100)))
if not iwid > 0 then
iwid = (cInt(iHt + 10))
end if
' create a new bitmap that will be the end result
Dim tb as New System.Drawing.Bitmap(iwid, iHt, PixelFormat.Format24BPPRGB)
' create a graphics object to work with
Dim tg as Graphics = Graphics.FromImage(tb)
' blank the image
tg.Clear(Color.Blue)
'# crop and resize!
' Draw image using the Pixel unit
' set above
tg.DrawImage(ti,new Rectangle(0,0,iwid,iHt),new Rectangle(0,0,ti.width,ti.height),unit)
ti.Dispose()
'delete the old thumbnail if available
if(System.IO.File.Exists("C:\myfolder\test_i.jpg")) = true then
System.IO.File.Delete("C:\myfolder\test_i.jpg")
end if
' save the thumbnail to the server
tb.Save("C:\myfolder\test_i.jpg", ImageFormat.JPEG)
' tidy up
tb.Dispose()
tg.Dispose()
end if
end sub
Any help on this would be Super!
Chris
"Illegitimis non carborundum"
(don't let the b@st@rds get you down)