Author |
Topic  |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 11 September 2007 : 07:08:27
|
I've fixed thumbgeneration and rename with an imager.dll-script I found somewhere on the net. Now when I upload the site to the live server they (offcourse) don't support that .dll...
They have the aspimage component on the server. Can anyone help me find info on how to create thumbs AND rename the thumbs with that component?
This is the code used now:
If Trim(Request.QueryString("action")) = "upld" Then if "" & FileCount -1 & "" > 3 then
Err_Msg = "<span class=""text"">Du har " & FileCount -1 & " filer, max antal är 4 filer.</span>"
end if Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.ProgressID = Request.QueryString("PID")
msg = ""
Upload.SaveVirtual SKF_strDir & folder
For each File in Upload.Files FName = fileExt(File.Path)
If allwExt(FName) = True Then File.SaveAsVirtual SKF_strDir & Folder & "/" & FName msg = msg + "<strong>" & FName & ":</strong> laddades upp!<br>" dim xml, strImagerDLL, bData, FileName, Width, Height FileName = "" & FName & "" FileCat = "" & SKF_strDIR & "" & Folder & "" Width = 90 Height = 90
strImagerDLL = "http://media.gotlandrace.se/auktionpics/Imager.dll" Set xml = Server.CreateObject("Microsoft.XMLHTTP") ' Creates an instance of MSXML4, if this fails, create a "MSXML2.ServerXMLHTTP" instead and remove False from the end of next line xml.Open "GET", strImagerDLL & "?Image=" & Server.Mappath(FileCat & "/" & FileName) & "&Width=" & Width & "&Height=" & Height, False xml.Send() bData = xml.ResponseBody Set xml = nothing Response.Write "<br>" & FileCat & "" & FileName & "" & vbNewLine dim oStream, fulltextlength, fullslashtext, strQString Set oStream = Server.CreateObject("ADODB.Stream") oStream.type = 1 'adTypeBinary oStream.mode = 3 'adModeReadWrite oStream.open oStream.write bData oStream.Position = 0 FileName = Left(FileName, Len(FileName)-4) & "_mt.jpg" Response.Write "<br><br>" & FileCat & "/" & FileName & "" & vbNewLine oStream.SaveToFile server.mappath(FileCat & "/" & FileName) oStream.Close Set oStream = Nothing Else msg = msg + "<strong>" & FName & ":</strong> är inte i tillåtet filformat!<br>" File.Delete End If Next
Response.Redirect "itemupload.asp?itemid=" & Folder & "&msg=" & msg
Upload.Close
Set Upload = Nothing
Elseif Trim(Request.QueryString("action")) = "delete" Then Set objFSO = CreateObject("Scripting.FileSystemObject") For each SKF_Item in Request.Form objFSO.DeleteFile SKF_strSaveFile&"\"&Request.Form(SKF_Item).Item SKF_Item2 = Left(Request.Form(SKF_Item), Len(Request.Form(SKF_Item))-4) & "_mt.jpg" objFSO.DeleteFile SKF_strSaveFile&"\"& SKF_Item2 Next
Response.Redirect "itemupload.asp?itemid=" & Folder & "&auktion=" & Auktion & ""
objFSO.Close Set objFSO = Nothing End If |
/Tribaliztic - www.gotlandrace.se -
|
|
MaD2ko0l
Senior Member
   
United Kingdom
1053 Posts |
Posted - 11 September 2007 : 09:24:07
|
hiya, i use this code to do what u want, this is from the latest project i am working on. this will rename the file to a member number that is passed from the upload page and then the date/time so that it is unique and then it will resize and ad "tn_" to the start of the file.
it may need some tweaking to get how u want it but its a start
|
© 1999-2010 MaD2ko0l |
 |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 11 September 2007 : 16:06:47
|
MaD2ko0l: I'll have a look at that code =)
MarshalMix: Isn't that just for .NET?
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
MaD2ko0l
Senior Member
   
United Kingdom
1053 Posts |
Posted - 11 September 2007 : 16:42:26
|
also, http://www.aspjpeg.com/ that site has the documentation and other things that will help u. |
© 1999-2010 MaD2ko0l |
 |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 11 September 2007 : 16:47:10
|
Is aspjpeg the same as aspimage?
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
pdrg
Support Moderator
    
United Kingdom
2897 Posts |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 11 September 2007 : 17:09:38
|
Ok, as I suspected then =) Means that the above examples/links won't work, or? |
/Tribaliztic - www.gotlandrace.se -
|
 |
|
weeweeslap
Senior Member
   
USA
1077 Posts |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 14 September 2007 : 15:55:15
|
Well, this host is a cheap low budget piece of cr-p host and they don't support more than they really have to =) I think I've found a solution using aspimage, will keep you updated...
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 16 September 2007 : 02:14:41
|
Well, it's not free... If it was free I hadn't had any problem with their limited support/components and so on =)
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 21 September 2007 : 18:29:37
|
Okay, I got this working.. Kinda..
This is the code:
<% '########################################### Call createthumbnail("physicalpathblaha","name of the file","90","90")
Function createthumbnail(strPath, strFilename, maxX, maxY) Set image = server.createobject("aspimage.image") if image.loadimage(strPath & "\" & strFilename) then intWidth = image.MaxX intHeight = image.MaxY 'Response.Write maxY 'Response.Write maxX 'Response.Write intHeight 'Response.Write intWidth if (intWidth<MaxX) and (intHeight<MaxY) then if intWidth>intHeight then intRatio=(maxX/intWidth) image.resizeR intWidth*intRatio, intHeight*intRatio else intRatio=(maxY/intHeight) image.resizeR intWidth*intRatio, intHeight*intRatio end if end if
'Optimised for JPEG thumbnails - generally better than GIFs Image.ImageFormat = 1 Image.PixelFormat = 6 strSfilename=split(strFilename,".") Image.Filename=strPath & "\" & strSfilename(0) & "_mt" picture= strSfilename(0) & "_mt" if Image.SaveImage then response.write "<img src=""itempics/98/" & picture & ".jpg"">" Set Image = nothing else 'You may want to put some kind of error handler in here Set Image = nothing end if else 'Error while loading, abort Set Image = nothing exit function end if end function
Test=createthumbnail(""& Server.MapPath("bilder") &"", ""& NewName & Ext &"", "86", "100")
'##################################### thumbnail **** %>
I get error on this line: intRatio=(maxY/intHeight)
Microsoft VBScript runtime error '800a000b'
Division by zero
It's because intHeight is 0, but why?
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
tribaliztic
Senior Member
   
Sweden
1532 Posts |
Posted - 22 September 2007 : 01:04:42
|
Sorry, I was really tired last night when I posted this =)
I called the function twice in the code.. *doh*
|
/Tribaliztic - www.gotlandrace.se -
|
 |
|
|
Topic  |
|