Avatar billede fun22 Nybegynder
10. oktober 2006 - 00:07 Der er 4 kommentarer og
1 løsning

Hvor i koden skal det her indsættes??

Hej..

Jeg bruger fckeditor, og skal lige have tilpasset upload billede funktionen..

<%@ CodePage=65001 Language="VBScript"%>
<%
Option Explicit
Response.Buffer = True
%>
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
*         http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
*         http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: upload.asp
*     This is the "File Uploader" for ASP.
*
* File Authors:
*         Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<!--#include file="config.asp"-->
<!--#include file="io.asp"-->
<!--#include file="class_upload.asp"-->
<%

' This is the function that sends the results of the uploading process.
Function SendResults( errorNumber, fileUrl, fileName, customMsg )
    Response.Write "<script type=""text/javascript"">"
    Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
    Response.Write "</script>"
    Response.End
End Function

%>
<%

' Check if this uploader has been enabled.
If ( ConfigIsEnabled = False ) Then
    SendResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/upload/asp/config.asp"" file"
End If

' The the file type (from the QueryString, by default 'File').
Dim resourceType
If ( Request.QueryString("Type") <> "" ) Then
    resourceType = Request.QueryString("Type")
Else
    resourceType = "File"
End If

' Create the Uploader object.
Dim oUploader
Set oUploader = New NetRube_Upload
oUploader.MaxSize    = 0
oUploader.Allowed    = ConfigAllowedExtensions.Item( resourceType )
oUploader.Denied    = ConfigDeniedExtensions.Item( resourceType )
oUploader.GetData

If oUploader.ErrNum > 1 Then
    SendResults "202", "", "", ""
Else
    Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
    sFileName        = ""
    sFileUrl        = ""
    sErrorNumber    = "0"

    ' Map the virtual path to the local server path.
    Dim sServerDir
    sServerDir = Server.MapPath( ConfigUserFilesPath )
    If ( Right( sServerDir, 1 ) <> "\" ) Then
        sServerDir = sServerDir & "\"
    End If

    Dim oFSO
    Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )

    ' Get the uploaded file name.
    sFileName    = oUploader.File( "NewFile" ).Name
    sExtension    = oUploader.File( "NewFile" ).Ext
    sOriginalFileName = sFileName

    Dim iCounter
    iCounter = 0

    Do While ( True )
        Dim sFilePath
        sFilePath = sServerDir & sFileName

        If ( oFSO.FileExists( sFilePath ) ) Then
            iCounter = iCounter + 1
            sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
            sErrorNumber = "201"
        Else
            oUploader.SaveAs "NewFile", sFilePath
            If oUploader.ErrNum > 0 Then SendResults "202", "", "", ""
            Exit Do
        End If
    Loop
    Response.Write( sFilePath )
    sFileUrl = ConfigUserFilesPath & sFileName   

    SendResults sErrorNumber, sFileUrl, sFileName, ""   
   
End If

Set oUploader = Nothing
%>

Det er følgende kode jeg skal have passet ind et sted:

Set Image = Server.CreateObject("AspImage.Image")

      Image.AutoSize = auto
      Image.LoadImage(sFilePath)
   
    If Image.MaxY > "200" Then
    response.write "Rezise"
        intYSize = "200"
        intXSize = (intYSize / Image.MaxY)
        intXSize = Image.MaxX / intXsize
       
        Image.ResizeR intXSize, intYSize
       
        Image.FileName = sFilePath &"1"
        Image.SaveImage

      End If

Hvor skal det indsættes???
Avatar billede ralfi Nybegynder
10. oktober 2006 - 01:09 #1
Umidlbart i en fil for sig selv ville jeg mene.. og så bruge php-include i <head>.. det vil sige noget ala:

<head>
<?php include('javascript.js'); ?>
</head>
Avatar billede fun22 Nybegynder
10. oktober 2006 - 01:15 #2
for det første har jeg ikke php men asp... og så kan jeg ikke se hvad du vil med det javascript?
Avatar billede ralfi Nybegynder
10. oktober 2006 - 01:33 #3
Nå men så brug den gamle html include ?
Ups.. så ikke det var et Visual Basic script, my bad..
Avatar billede madeindk Nybegynder
10. oktober 2006 - 19:59 #4
Jeg kunne da ikke forestille mig andet end det skulle se ud som følger:

<!--

* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
*        http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
*        http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: upload.asp
*    This is the "File Uploader" for ASP.
*
* File Authors:
*        Frederico Caldeira Knabben (fredck@fckeditor.net)

-->

<%
Option Explicit
Response.Buffer = True
%>

<!--#include file="config.asp"-->
<!--#include file="io.asp"-->
<!--#include file="class_upload.asp"-->

<%
' This is the function that sends the results of the uploading process.
Function SendResults( errorNumber, fileUrl, fileName, customMsg )
    Response.Write "<script type=""text/javascript"">"
    Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
    Response.Write "</script>"
    Response.End
End Function

' Check if this uploader has been enabled.
If ( ConfigIsEnabled = False ) Then
    SendResults "1", "", "", "This file uploader is disabled. Please check the ""editor/filemanager/upload/asp/config.asp"" file"
End If

' The the file type (from the QueryString, by default 'File').
Dim resourceType
If ( Request.QueryString("Type") <> "" ) Then
    resourceType = Request.QueryString("Type")
Else
    resourceType = "File"
End If

' Create the Uploader object.
Dim oUploader
Set oUploader = New NetRube_Upload
oUploader.MaxSize    = 0
oUploader.Allowed    = ConfigAllowedExtensions.Item( resourceType )
oUploader.Denied    = ConfigDeniedExtensions.Item( resourceType )
oUploader.GetData

If oUploader.ErrNum > 1 Then
    SendResults "202", "", "", ""
Else
    Dim sFileName, sFileUrl, sErrorNumber, sOriginalFileName, sExtension
    sFileName        = ""
    sFileUrl        = ""
    sErrorNumber    = "0"

    ' Map the virtual path to the local server path.
    Dim sServerDir
    sServerDir = Server.MapPath( ConfigUserFilesPath )
    If ( Right( sServerDir, 1 ) <> "\" ) Then
        sServerDir = sServerDir & "\"
    End If

    Dim oFSO
    Set oFSO = Server.CreateObject( "Scripting.FileSystemObject" )

    ' Get the uploaded file name.
    sFileName    = oUploader.File( "NewFile" ).Name
    sExtension    = oUploader.File( "NewFile" ).Ext
    sOriginalFileName = sFileName

    Dim iCounter
    iCounter = 0

    Do While ( True )
        Dim sFilePath
        sFilePath = sServerDir & sFileName

        ' Tjekker om filen eksisterer i forvejen - tror jeg
        If ( oFSO.FileExists( sFilePath ) ) Then
         
            iCounter = iCounter + 1
            sFileName = RemoveExtension( sOriginalFileName ) & "(" & iCounter & ")." & sExtension
            sErrorNumber = "201"
           
        Else
           
            Set Image = Server.CreateObject("AspImage.Image")
           
            Image.AutoSize = auto
            Image.LoadImage(sFilePath)
               
            If Image.MaxY > "200" Then
                                       
            intYSize = "200"
            intXSize = (intYSize / Image.MaxY)
            intXSize = Image.MaxX / intXsize
                   
            Image.ResizeR intXSize, intYSize
                   
            Image.FileName = sFilePath &"1"
            Image.SaveImage
           
            End If
       
            Set Image = Nothing
       
        End If
    Loop
    Response.Write( sFilePath )
    sFileUrl = ConfigUserFilesPath & sFileName   

    SendResults sErrorNumber, sFileUrl, sFileName, ""   
   
End If

Set oUploader = Nothing
%>
Avatar billede fun22 Nybegynder
10. oktober 2006 - 21:21 #5
har jeg prøvet.. virker ikke... Er gået over til en anden editor...
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