Avatar billede nythjem Nybegynder
06. juli 2004 - 16:55 Der er 11 kommentarer og
1 løsning

Online billede editering?

Hej Alle!

Jeg kunne godt tænke mig, at kunne rezise eller udskære et billede, og dernæst gemme det.

Jeg har fundet et link (http://customer.sitevision.dk/smsas/cropimage/default.asp?l=crop&phone=13&m=HP&remoteimg=http%3A%2F%2Fimages%2Ehotpeople%2Edk%2Fshowphoto%2Easp%3FuID%3D188478%26pID%3D645171%26thumb%3Dfalse%26cs%3DA8E0E), der gør ala det, men er det nogle, der eventuelt kender et link til noget online billede editering (freeware)??

På forhånd tak
Avatar billede tofte Juniormester
06. juli 2004 - 17:34 #1
har du et billedekomponent på din server?
Avatar billede nythjem Nybegynder
06. juli 2004 - 19:09 #2
Hej Tofte!

Jeg har dem her..

ServerObjects-komponenter:
• AspMAIL
• AspPOP3
• AspHTTP
• AspDNS
• AspIMAGE

Dimac-komponenter:
• w3 JMail
• w3 Sockets

aspSmart-komponenter:
• aspSmartUpload

Persits Software-komponenter:
• AspUPLOAD
• AspXUpload
• AspJpeg
• AspPDF
Avatar billede goat Nybegynder
06. juli 2004 - 23:45 #3
Der var du heldig !

ASP JPEG komponenten fra Persits Software lader dig gøre netop det du gerne vil.
For konkret anvendelse, se: http://www.aspupload.com/aspjpeg.html

GoatMan
Avatar billede nythjem Nybegynder
07. juli 2004 - 14:24 #4
Tak for det :)

Kigger lidt nærmere på det :)
Avatar billede montago Praktikant
26. oktober 2004 - 11:52 #5
jeg har et script liggende til at skære i et billede... lidt primitivt... men brugbart
Avatar billede lund_dk Praktikant
26. oktober 2004 - 11:55 #6
montago > Noget du giver ud ? :)
Avatar billede montago Praktikant
26. oktober 2004 - 12:24 #7
Resizer.asp:

<%
Response.Expires = 0
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open(Server.MapPath("pix/" & Request.QueryString("img")))
Jpeg.Width = Request.QueryString("Width")
Jpeg.Height = Jpeg.OriginalHeight * Jpeg.Width / Jpeg.OriginalWidth
Jpeg.SendBinary
%>
Avatar billede montago Praktikant
26. oktober 2004 - 12:24 #8
Cropper.asp

<%
Response.Expires = 0
Set Jpeg = Server.CreateObject("Persits.Jpeg")

Jpeg.Open( Server.MapPath("pix/" & Request.QueryString("Image")))

if Request.QueryString("F.x") <> "" and Request.QueryString("S.x") = "" then
    Jpeg.Crop Request.QueryString("F.x"),Request.QueryString("F.y"),Jpeg.Width,Jpeg.Height
Elseif Request.QueryString("F.x") <> "" and Request.QueryString("S.x") <> "" then
    F_X = Request.QueryString("F.x")
    F_Y = Request.QueryString("F.y")
    S_X = Cint( Request.QueryString("S.x") ) + Cint( Request.QueryString("F.x") )
    S_Y = Cint( Request.QueryString("S.y") ) + Cint( Request.QueryString("F.y") )
    Jpeg.Crop F_X,F_Y,S_X,S_Y
End if
Jpeg.Quality = 100
Jpeg.SendBinary

%>
Avatar billede montago Praktikant
26. oktober 2004 - 12:25 #9
Index.asp

<%
    Server.ScriptTimeout = 320
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder(Server.MapPath("/cropping/pix/"))
%>
<html>
<head>
<script language="javascript">
function preloadImages() {
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
</script>
</head>
<body onLoad="preloadImages(<%
    for each img in fo.files
        Response.Write "'http://mdk/Cropping/Resizer.asp?img=" & img.name & "width=200',"
    next
%>'')">
<div align="center">
<% if Request.QueryString("Save") = "" and Request.QueryString("Cropped") = "" then %>
    <% if Request.QueryString("F.x") = "" and Request.QueryString("S.x") = "" and Request.QueryString("Image") = "" Then %>
    <h3>Pictures avaiable to crop'n'resize:</h3>
    <Form Method="post" Action="Upload.asp" ENCTYPE="multipart/form-data">
        <input type="FILE" name="FILE1" size="30">
        <input type="submit" value="Upload">
    </Form>
    <%
   
    Set Jpeg = Server.CreateObject("Persits.Jpeg")
   
    if Request.QueryString("Delete") <> "" then
        fs.DeleteFile(Server.MapPath("pix/" & Request.QueryString("Delete")))
        Response.Redirect("index.asp")
    end if
   
    for each x in fo.files
        ext = Split(x.name,".")
        if Lcase(ext(ubound(ext))) = "jpg" then
        Response.Write "<table><tr><td>"
            Response.write "<a href=""?Image=" & x.name & """><img width=""200"" src=""Resizer.asp?img=" & x.name & "&width=200""></a>"
        Response.Write "</td><td>"
            Jpeg.Open(Server.MapPath("pix/" & x.name))
            Response.Write "<li>" & x.name
            Response.Write "<li>" & formatnumber(x.size/1024,2) & " kilobytes"
            Response.Write "<li>" & Jpeg.width & " x " & Jpeg.height & " pixels"
            Response.Write "<li><a OnClick=""return confirm('Are you shure you want to\n\nDELETE?');"" href=""?delete=" & x.name & """>Delete</a>"
            Response.Write "<li><a href=""pix/" & x.name & """>Show normal size</a>"
        Response.Write "</td></tr></table>"
        end if
    next
    %>
    <% elseif Request.QueryString("F.x") = "" and Request.QueryString("S.x") = "" and Request.QueryString("Image") <> "" Then %>
    <form method="get">
        <h3>Use the Mouse to locate the <u>Upper Left</u> Cropping Coordinate</h3>
        <table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FF0000">
          <tr>
            <td><input type="image" name="F" src="pix/<%=Request.QueryString("Image")%>"></td>
          </tr>
        </table>
        <input type="hidden" name="Image" value="<%=Request.QueryString("Image")%>">
    </form>
    <% elseif Request.QueryString("F.x") <> "" and Request.QueryString("S.x") = "" and Request.QueryString("Image") <> "" Then %>
    <form method="get">
        <h3>Use the Mouse to locate the <u>Lower Right</u> Cropping Coordinate</h3>
        <table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FF0000">
          <tr>
            <td><input type="image" name="S" src="Cropper.asp?Image=<%=Request.QueryString("Image")%>&F.y=<%=Request.QueryString("F.y")%>&F.x=<%=Request.QueryString("F.x")%>"></td>
          </tr>
        </table>
        <input type="hidden" name="Image" value="<%=Request.QueryString("Image")%>">
        <input type="hidden" name="F.x" value="<%=Request.QueryString("F.X")%>">
        <input type="hidden" name="F.Y" value="<%=Request.QueryString("F.Y")%>">
    </form>
    <% elseif Request.QueryString("F.x") <> "" and Request.QueryString("S.x") <> "" and Request.QueryString("Image") <> "" Then %>
    <form method="get">
        <h3>If the crop is as you want it... click Save, Else use BackSpace to Undo the last opperations</h3>
        <table border="1" cellpadding="0" cellspacing="0" bordercolor="#000000" bgcolor="#FF0000">
          <tr>
            <td><input type="image" name="S" src="Cropper.asp?Image=<%=Request.QueryString("Image")%>&F.y=<%=Request.QueryString("F.y")%>&F.x=<%=Request.QueryString("F.x")%>&S.x=<%=Request.QueryString("S.x")%>&S.y=<%=Request.QueryString("S.y")%>"></td>
          </tr>
        </table>
        <input type="hidden" name="Image" value="<%=Request.QueryString("Image")%>">
        <input type="hidden" name="F.x" value="<%=Request.QueryString("F.X")%>">
        <input type="hidden" name="F.y" value="<%=Request.QueryString("F.Y")%>">
        <input type="hidden" name="S.x" value="<%=Request.QueryString("S.X")%>">
        <input type="hidden" name="S.y" value="<%=Request.QueryString("S.Y")%>">
        <input type="submit" name="Save" value="Save Cropped Image">
    </form>
    <% End if %>
<% Elseif Request.QueryString("Cropped") = "1" then %>
    <img src="<%=Request.QueryString("Image")%>"><br>
    Compressed <%=Request.QueryString("Q")%>%<br>
    Rightclick to "save as"
<%
    Set Jpeg = Server.CreateObject("Persits.Jpeg")
    Jpeg.Open(Server.MapPath(Request.QueryString("Image")))
Else
    Set Jpeg = Server.CreateObject("Persits.Jpeg")
    Jpeg.Open(Server.MapPath("pix/" & Request.QueryString("Image")))
'Crop
    Jpeg.Crop Request.QueryString("F.x"),Request.QueryString("F.y"),(Cint(Request.QueryString("S.x")) + Cint(Request.QueryString("F.x"))),(Cint(Request.QueryString("F.y")) + Cint(Request.QueryString("S.y")))
'Save
    Jpeg.Quality = 100
    Jpeg.Save Server.MapPath("pix/" & Request.QueryString("Image"))
'Resize if > 650
    Jpeg.Open(Server.MapPath("pix/" & Request.QueryString("Image")))
    If Jpeg.Width > 650 then
        Jpeg.Width = 650
        Jpeg.Height = Jpeg.OriginalHeight * Jpeg.Width / Jpeg.OriginalWidth
    end if
    Jpeg.Save Server.MapPath("pix/" & Request.QueryString("Image"))
'End Resize
   
    set fso = Server.CreateObject("Scripting.FileSystemObject")
    set fil = fso.GetFile(Server.MapPath("pix/" & Request.QueryString("Image")))
    FileSize = fil.Size   
       
    Do while FileSize >= 40*1024
        Jpeg.Open(Server.MapPath("pix/" & Request.QueryString("Image")))

        Jpeg.Quality = 100 - Quality

        Jpeg.Save Server.MapPath("Temp.jpg")
       
        set fso = Server.CreateObject("Scripting.FileSystemObject")
        set fil = fso.GetFile(Server.MapPath("Temp.jpg"))
        FileSize = fil.Size
        Response.Write FileSize & "<br>"
        Quality = Quality + 1
    Loop
   
    Jpeg.Open(Server.MapPath("pix/" & Request.QueryString("Image")))
    Jpeg.Quality = 100 - Quality
    Jpeg.Save Server.MapPath("pix/" & Request.QueryString("Image"))
   
    Response.Redirect("index.asp")'"?Cropped=1&Image=" & Request.QueryString("Image") & "&Q=" & Quality)
End if
%>
</div>

</body>
</html>
Avatar billede montago Praktikant
26. oktober 2004 - 12:25 #10
Upload.asp

<%
On Error Resume Next
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
    mySmartUpload.AllowedFilesList = "jpg"
    mySmartUpload.DeniedFilesList = "asp,htm,html,exe,zip,rar"
    'mySmartUpload.MaxFileSize = 40*1024
    mySmartUpload.Upload
   
    intCount = mySmartUpload.Save("pix")

If Err Then
    Response.Write("<b>Wrong selection : </b>" & Err.description)
Else
    Response.Redirect("index.asp")
End if
%>
Avatar billede montago Praktikant
26. oktober 2004 - 12:26 #11
der skal ligge en /pix mappe i samme bib
Avatar billede montago Praktikant
26. oktober 2004 - 12:27 #12
BTW...  scriptet er optimeret til at lave jpg billeder som er

MAX 650 pix bred
MAX 40kb stor

disse tal kan ændres
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester