날씨 RSS 서비스

날씨 RSS 서비스

자료 수집소/유용한 정보 2007/01/26 01:46
야후 날씨 서비스에서는 전 세계 날씨 정보를 제공한다. 아래는 서울 날씨 정보..
http://weather.yahoo.com/forecast/KSXX0037_f.html



http://xml.weather.yahoo.com/forecastrss/KSXX0037_f.xml
그리고 날씨 RSS Feed도 제공하는데 나름 정확하지 싶다.

모 사이트 처럼 이상한 정보를 주는 것 같지 않으니 다음에라도 써봐야 겠당..
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/07/05 15:44 2007/07/05 15:44
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2524

XDO: An XML Engine Class for Classic ASP


http://www.devarticles.com/c/a/ASP/XDO-An-XML-Engine-Class-for-Classic-ASP/1/


In this article, Carlos explains how to integrate XML into your applications using ASP.

Summary:

This article details an approach to integrating XML into database-driven applications or websites using classic ASP. The goal of this approach is to encapsulate database interactions into a reusable object that will handle data retrieval, including simple hierarchical data, by leveraging ADO and XML.

The result is the beginning of a framework that allows the separation of the data, business and data-access layers. This, in turn, facilitates the implementation of distributed application architectures.

Introduction:

By now most web developers have heard of XML and of its value to the web and distributed computing. In classic ASP, Microsoft has provided the pieces for developers to take advantage of XML in different ways. This article suggests a framework for making database driven ASP applications using only XML. It achieves this goal by encapsulating data retrieval into a VBScript class.

Prerequisites:

This article requires that the reader be familiar with the following:
• VBScript Classes and the advantages of OO design,
• XML, XSL, their use in ASP, and advantages, and
• ADO and its use in ASP, particularly persistence of Recordsets and Data-Shaping.

Overview:

Many articles have been written demonstrating object-oriented (OO) and XML features available in ASP including:

1. Creating a Datagrid Class in classic ASP - 2-Dimensional Arrays by Brian O'Connell
2. A Generic GetRows VBScript Class
3. Using Classes in ASP (OOP in ASP/VBScript - Part #2) by Marcus Brinkhoff
4. Converting Hierarchical Recordsets Into XML By Richard Chisholm
5. Increasing ConvertRStoXML() Performance By David O'Neill
6. An ASP Class for XML Data Transfer by Seth Juarez

These articles adequately explain the benefits of OO design and of XML use in ASP. The data access objects even show how OO design can help manage creation and destruction of precious ADO connection objects.

However, they still either bind the interface to the data (as in the DataGrid article) or they still looped through recordsets or arrays to create their XML. It was not until Transforming ADO Recordsets to XML with XSLT that we begin to see that we can piece the tools available in the classic ASP platform to create a reusable, extensible, and flexible framework with XML as the foundation.

XDO seeks to implement such a framework and makes it possible to retrieve XML data from the database. This allows the developer to have SQL Server-like XML capabilities with any database that can be accessed with ADO via OLEDB.

Design:

Current architectures for distributed applications recommend object models that follow object factory (or engine – collection – class) design patterns. XDO emulates this design pattern for the data access tier in n-tier architectures. Business rules, captured as function libraries or as other classes, can create an instance of the XDO object and return XML that matches the rule coded within the called function or object method. The resulting XML is then transformed with XSLT to render the user interface (See figure 1).



XDO is a custom data access object that encapsulates the functionality of MSADO objects. In a “real-world” implementation, no ASP page interfaces with ADO objects directly. Instead, ASP pages create instances of the XDO object, which in turn interacts with ADO. Instances of ADO Connections and Recordsets are managed by XDO. Furthermore, Business objects can encapsulate the instantiation of XDO objects.

Examples include a Customer XML Engine or a Catalog XML Engine. This adds another layer of abstraction in the object model thereby separating business rules from the presentation (display) code.


XDO is a custom data access object that encapsulates the functionality of MSADO objects. In a “real-world” implementation, no ASP page interfaces with ADO objects directly. Instead, ASP pages create instances of the XDO object, which in turn interacts with ADO. Instances of ADO Connections and Recordsets are managed by XDO. Furthermore, Business objects can encapsulate the instantiation of XDO objects.

Examples include a Customer XML Engine or a Catalog XML Engine. This adds another layer of abstraction in the object model thereby separating business rules from the presentation (display) code.

The required components of this framework are:
• IIS 4.0+ running VBScript 5.0+,
• MSXML parser 3.0+, and
• Microsoft’s ADO 2.0+

The main object used in the architecture is the XDO object. This object is a stateless component that returns an XML document object model (DOM’s) of data in the database. These XML DOMs are stateful representations of customers, employees, orders, and products. The XML DOM represents the data describing the object.

Implementation:

The sample code provided demonstrates the use of the XDO framework. It uses the Northwind Access database for the data-source but will work for and ADO accessible database. The default.asp page displays a drop-down list of customers by default and allows the user to click buttons to view either the selected customer’s details or their 3 most recent orders.

Execution of the typical ASP page in this framework involves adding the class references to the page through #include directives, validating the request, creating an instance of the business object engine, CustomerXMLEngine, calling the appropriate business object method, transforming the data with appropriate XSL, and returning the resulting HTML interface.

The demo is made up of:

• The default.asp page, that controls which business object method is called,
• The Class.CustomerXMLEngine.asp, that houses the business model’s logic, and
• XSL stylesheets, that are used to transform the returned XML. The default.asp determines which view is displayed based on the arguments submitted.
• XDO, with serves as the

Default.asp

This design allows the same ASP page to render 3 different interfaces (Figure 2). Looking at the code, one can see that the implementation code is reduced to a few lines of code.



The default.asp page interacts with the business object using the “new” statement, returning an instance of the business object.

'/// CREATE AN INSTANCE OF THE CustomerXMLEngine
dim engCustomer : set engCustomer = new CustomerXMLEngine


Data is retrieved from the CustomerXMLEngine object by calling its methods. The example below returns a simple list of customers (ID and CompanyName) and is transformed into a drop-down list using xsl.

'/// GET A STYLE SHEET
dim objXSL
set objXSL = loadStyleSheet("xsl/customerSimpleList.xsl")
'/// CALL THE getSimpleCustomerList AND TRANSFORM TO GET DROPDOWN LIST
dim sCustomerDropDown
sCustomerDropDown = engCustomer.getSimpleCustomerList().transformNode(objXSL)


Class.CustomerXMLEngine.asp

The CustomerXMLEngine contains the rules that define what data to retrieve from the database and applying any rules (like applying a customer discount) at that time. Each method has a SQL statement that determines the resulting XML. On initialization, the business object creates a single instance of the XDO object and sets the connection string.

'INITIALIZE OBJECT
Private Sub Class_Initialize()
m_sObjectTag = "Customer"
set m_oXDO = new CXDO
m_oXDO.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& Server.MapPath(".") & "\database\NWIND.mdb;"
End Sub


This instance of the XDO object is used in each method to execute their SQL and returns an XML dataset.

Public Function getCustomerList()
dim sSQL : sSQL = "SELECT * FROM Customers"
set getCustomerList = getDOM(sSQL)
End Function

'GET XML DOM FOR PROVIDED SQL
Private Function getDOM(SQL)
set getDOM = m_oXDO.getXMLDOM(m_sObjectTag, SQL)
End Function


The XML is returned as a DOM object to facilitate XSL transformation.

XDO

At the heart of this framework lies the XDO object. It is designed to convert Recordsets, including hierarchical (or shaped) Recordsets, into element-based xml. I chose element-based xml to facilitate the creation of XSL templates.

An XDO instance’s lifespan begins with the creation of an ADO Connection. This Connection is available to the XDO object until the terminate method is called. The primary method is getXML, which is exposed as a public method if only the xml string is needed. A secondary public function is getXMLDOM.

This method calls getXML, loads the xml string into an XML DOM object, and returns the DOM instance.
The getXML method, when called, executes the loadData() method. This calls openConnection() and the MSDataShape provider is set if the a shaped SQL statement is provided.

Private Sub openConnection()
dim sConn : sConn = m_sConn
if (Instr(1, UCase(m_sSQL), "SHAPE") = 1) then
if (m_Connection.State = adStateOpen) then m_Connection.Close()
m_Connection.Provider = "MSDataShape"
sConn = Replace(sConn, "Provider", "Data Provider")
end if
if (m_Connection.State <> adStateOpen) then m_Connection.Open(sConn)
End Sub


Next, loadData() executes the query and the Recordset is persisted as XML using the Recordset’s Save() method. At this point, the XML format is in the Microsoft ADO-specific markup. I have written a generic XSL template that transforms shaped and non-shaped Recordsets from the Microsoft markup to element-based markup. This XSL is coded as a string, instead of an external XSL file, to aid XDO’s portability. After the transformation, the resulting XML string is returned.

Though the demo is implemented as VBScript classes, this model is easily translated to COM or other platforms. I have used VBScript classes because some of my clients and my web-host do not support custom COM development.

XDO facilitates the creation of XSL templates by rendering element-based (also called tag-based) XML. Element-based XML, unlike attribute-based XML (like that of ADO), uses a simpler XSL syntax. This makes creation or updating of XSL templates, which render HTML, much easier. Also, the XML document object model (or DOM) still allows searching and sorting of data and requires less overhead than an ADO Recordsets.

Persistence to the database is not mentioned in this model. However, there are a number of ways to address this. One might extend the XDO object to support persistence to the database. Another method might be to create a separate database persistence object to handle this function. Either way this function would also be encapsulated by the business object and not directly called by the ASP page.

This framework separates web applications into different tiers, a data tier, a business rules tier, and the presentation tier. This delegation of duties is clearly delineated with XDO, ADO, and the database making up the data tier, the CustomerXMLEngine in the business rules tier, and XML, XSL and HTML in the presentation tier.

Extending a business object is as simple as adding the new method and altering the default page to process the inputs and render the appropriate interface with XSL. Adding a new Business object, like an EmployeeXMLEngine, is easy to create with the CustomerXMLEngine as a template. The result is a flexible architecture that is easy to expand and maintain.

Further Reading:
Creating a Datagrid Class in classic ASP - 2-Dimensional Arrays by Brian O'Connell
A Generic GetRows VBScript Class
Using Classes in ASP (OOP in ASP/VBScript - Part #2) by Marcus Brinkhoff
Converting Hierarchical Recordsets Into XML By Richard Chisholm
Increasing ConvertRStoXML() Performance By David O'Neill
An ASP Class for XML Data Transfer by Seth Juarez
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/29 23:54 2007/06/29 23:54
Response
No Trackback , 2 Comments
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2511

XML Notepad 2007

http://www.microsoft.com/downloads/details.aspx?FamilyID=72D6AA49-787D-4118-BA5F-4F30FE913628&displaylang=en

XML Notepad 2007

Brief Description
XML Notepad 2007 provides a simple intuitive user interface for browsing and editing XML documents.


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/29 18:25 2007/06/29 18:25
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2509

http://support.microsoft.com/default.aspx?scid=kb;KO;193225


http://support.microsoft.com/default.aspx?scid=kb;KO;193225


< %@ Language=VBScript %>
< html>
< head>
< title>Oracle Test
< /head>
< body>
< center>
< %
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=MSDAORA;Data Source=;User Id=;Password=;"

Set objRs = objConn.Execute("SELECT * FROM DEMO.EMPLOYEE")

Response.Write ""
Response.Write ""

For I = 0 To objRS.Fields.Count - 1
Response.Write ""
Next

Response.Write ""

Do While Not objRS.EOF
Response.Write ""

For I = 0 To objRS.Fields.Count - 1
Response.Write ""
Next

Response.Write ""

objRS.MoveNext
Loop

Response.Write "
" & objRS(I).Name & "
" & objRS(I) & "
"

objRs.Close
objConn.Close
%>
< /center>
< /body>
< /html>
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/21 09:35 2007/06/21 09:35
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2487

꼭 블로그가 아니더라도 XML RSS 는 이제 어느정도 대세가 되어가고 있는 듯합니다. 이제는 언론사나 커뮤니티 등에서도 RSS 가 나옵니다.. 그리고 #Reader나 Xpyder,FreeDemon 등의 RSS 구독기 또한 점차 넓게 사용되고 있습니다. 여기서는 이러한 XML RSS 를 구현하는 방법을 ASP 기반에서 XML 컴포넌트를 이용하여 구현하고자 합니다.

사실 RSS 를 구현할때 사실 단순히 텍스트 파일로 뿌려주고 ContentType 만 xml 로 선언해줘도 가능합니다. 그러나 조금은 다르게 해보고 싶다는 저의 호기심도 있고, 확장성과 향후 유지보수에 조금이라도 더 손쉽게 하기위해서 윈도우즈 2000 에 기본제공되어 있는 XML 관련 컴포넌트를 이용하여 구현해보았습니다. 물론 아래 소스는 지금 제 블로그 RSS 의 원형이 되고 있습니다.

한가지 주의 하실점은 XML 선언전에 어떠한 개행( ) 이나 문자가 들어가서는 안됩니다. PHP 에서의 쿠키과 마찬가지 입니다.

< ?xml version="1.0" encoding="EUC-KR" ? >

< %
Response.ContentType = "text/xml"
Set xmlPars = Server.CreateObject("Msxml2.DOMDocument")

' 여기서 부터 rss 정보를 담는다.
Set rss = xmlPars.CreateElement("rss")
rss.setAttribute "version", "2.0"
rss.setAttribute "xmlns:dc", "http://purl.org/dc/elements/1.1/"
rss.setAttribute "xmlns:sy", "http://purl.org/rss/1.0/modules/syndication/"
rss.setAttribute "xmlns:admin", "http://webns.net/mvcb/"
rss.setAttribute "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlPars.AppendChild(rss)

'< channel> 시작

Set Channel = xmlPars.CreateElement("channel")
rss.AppendChild(Channel)

'< title>정보
Set title = xmlPars.CreateElement("title")
Channel.AppendChild(title)
Channel.childnodes(0).text = "블로그 제목"

'< link>정보
Set channel_link = xmlPars.CreateElement("link")
Channel.AppendChild(channel_link)
Channel.childnodes(1).text = "블로그 주소"

'< description>정보
Set description = xmlPars.CreateElement("description")
Channel.AppendChild(description)
Channel.childnodes(2).text = "블로그 설명"

'< dc:language>정보
Set language = xmlPars.CreateElement("dc:language")
Channel.AppendChild(language)
Channel.childnodes(3).text = "ko"

'< image>정보
Set image = xmlPars.CreateElement("image")
Channel.AppendChild(image)

'이미지 정보에 들어갈 것들
set i_title = xmlPars.CreateElement("title")
set i_url = xmlPars.CreateElement("url")
set i_width = xmlPars.CreateElement("width")
set i_height = xmlPars.CreateElement("height")

image.AppendChild(i_title)
image.AppendChild(i_url)
image.AppendChild(i_width)
image.AppendChild(i_height)

image.childnodes(0).text = "이미지 제목"
image.childnodes(1).text = "이미지 경로"
image.childnodes(2).text = "이미지 가로 사이즈"
image.childnodes(3).text = "이미지 세로 사이즈"

' 여기서 부터는 포스트에 대해서 출력

' 우선 데이터를 읽어오자
SQL = "해당되는 포스트에 대한 쿼리문"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQL,접근문자열,adOpenForwardOnly,adLockPessimistic,adCmdText

' 여기서 부터 루프를 돌리자.
Do until rs.EOF

' 이라는 노드를 추가
Set item = xmlPars.CreateElement("item")
Channel.AppendChild(item)

' 여기서부터 해당 포스트의 세부 정보를 출력
set title = xmlPars.CreateElement("title") '
set link = xmlPars.CreateElement("link")
set description = xmlPars.CreateElement("description")
set dcdate = xmlPars.CreateElement("dc:date")
set dcsubject = xmlPars.CreateElement("dc:subject")

item.AppendChild(title)
item.AppendChild(link)
item.AppendChild(description)
item.AppendChild(dcdate)
item.AppendChild(dcsubject)

item.childnodes(0).text = rs("제목필드")
item.childnodes(1).text = rs("포스트 고유 url 필드")
item.childnodes(2).text = rs("내용 필드")
item.childnodes(3).text = rs("날짜 필드")
item.childnodes(4).text = rs("포스트의 분류 필드")

rs.movenext
oop

' 마지막으로 최종적으로 뿌려주자.
Response.Write xmlPars.xml

'마무리 ^^;

rs.close
set rs = nothing
Set xmlPars = nothing

% >
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/06/16 12:42 2007/06/16 12:42
Response
No Trackback , a comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2475

한빛미디어 - 루비 관련기사

한빛미디어 - 루비 관련기사

http://network.hanb.co.kr/view.php?bi_id=1349

http://network.hanb.co.kr/view.php?bi_id=1350

http://network.hanb.co.kr/view.php?bi_id=1375
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/05/19 11:33 2007/05/19 11:33
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2432

ASP 에서 MYSQL 연동하기

ASP하면 MS-SQL, PHP하면 mysql이 생각납니다. 이에 대해서는 여러가지 이유가 있겠지만, 궁합(?)이 가장 잘 맞기 때문이겠죠~

하지만, 실무현장에는 여러가지 이유로 이러한 궁합이 깨지곤 하는데요. PHP + Oracle, ASP + MySQL등이 이러한 경우입니다. 연동하는데 그다지 어려운 점은 없지만, 도움이 필요하신 분들을 위해 간략하게 작성해봅니다.


* IIS 설정 방법과 MySQL, MyODBC 설치방법은 생략합니다.


:: 다운로드

MySQL 4.1
http://dev.mysql.com/downloads/mysql/4.1.html

MySQL Connector/ODBC 3.51
http://dev.mysql.com/downloads/connector/odbc/3.51.html

MySQL Query Browser
http://dev.mysql.com/downloads/query-browser/1.1.html


:: 설치

MySQL과 MyODBC, Query Brower를 설치합니다.


:: database와 table 생성

MySQL Query Browser를 이용하여 아래와 같이 address와 contacts를 생성합니다.

1) address 생성

create database address;

2) assress 사용

use address;

3) contacts 생성

create table contacts
(

contactId int auto_increment not null,

firstName varchar(50),

lastName varchar(50),

address1 varchar(100),

address2 varchar(100),

phone varchar(20),

primary key(contactId),

unique id(contactId)

);


:: dns_test.asp 작성

생성한 DB에 접근할 수 있는지 확인하기 위해 아래와 같이 작성합니다.

<%

dim adoConn

set adoConn = Server.CreateObject("ADODB.Connection")

adoConn.Open "Driver={MySQL ODBC 3.51 driver}; Server=localhost; Database=address; Uid=root;Pwd=121212;"

if adoConn.errors.count = 0 then

response.write "Connected Successfully!"

end if

adoConn.close
set adoConn = nothing

%>


브라우저를 통해 http://localhost/dns_test.asp 를 입력해 Connected Successfully 라는 글이 나타난다면 ASP에서 MySQL를 사용할 준비가 된 것입니다.


:: 꼭 알아두기

adoConn.Open "Driver={MySQL ODBC 3.51 driver}; Server=localhost; Database=address; Uid=root;Pwd=121212;"

이 내용이 가장 중요합니다. Driver를 MySQL ODBC 3.51 driver로 지정해주었다는 것을 기억하세요.


:: 참조

http://dev.mysql.com/doc/refman/5.0/en/odbc-connector.html

http://www.devarticles.com/c/a/ASP/Using-MyODBC-To-Access-Your-MySQL-Database-Via-ASP/
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/05/18 18:25 2007/05/18 18:25
Response
No Trackback , a comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2431

ASP에서 python 사용하기[펌]

ASP에서 python 사용하기

당연히 파이썬이 설치되어 있어야 한다.

(PWS)Personal Web Server 혹은 IIS(Internet Information Server)가 설치되어 있어야 한다.

win32all을 설치한다. 다음의 링크에서 파이썬 버전에 맞는 win32all을 설치한다.

http://aspn.activestate.com/ASPN/Downloads/ActivePython/Extensions/Win32all 혹은 http://starship.python.net/crew/mhammond/win32/Downloads.html

다음과 같이 pyscript.py를 실행시킨다. 파이썬 2.1인 경우는 다음 디렉토리에 있다. (버전에 맞는 python.exe로 실행하는 것을 주의하라). 보안 문제로 클라이언트의 파이썬 스크립트는 기능을 죽인다.

C:\Python21\win32comext\axscript\client\pyscript.py --unregister

다음과 같은 샘플 코드(pythontest.asp)를 작성한다(웹의 루트디렉토리에 저장한다).

< %@ Language = Python %>
< %
import sys
sys.stdout.write = Response.Write

s = "서버측 코드 실행 성공"
print s
= s.split()
.reverse()
print '
단어 역으로 바꾸기
'
print ' '.join(l)
print 'Testing..'
% >



< script language="JavaScript">
document.write("클라이언트측 코드 실행 성공")
< /script>



< script language="Python" runat="server">
print '다시 서버측 코드..'
< /script>
주의 ASP 내에 파이썬 스크립트를 삽입할 경우 들여쓰기에 주의해야 합니다. 파이썬 자체가 들여쓰기를 기준으로 단락을 구분하기 때문에 주의를 기울이지 않으면 생각보다 에러가 많이 발생합니다. 특히 조건문이나 for 문과 같은데에서는 더더욱 조심해야 하구요. - 박기석, 2001.12.03. -



인터넷 익스플로러에서 http://localhost/pythontest.asp 를 입력한다. 다음과 같은 실행결과가 나오면 성공!

서버측 코드 실행 성공
단어 역으로 바꾸기
성공 실행 코드 서버측 Testing..
클라이언트측 코드 실행 성공
다시 서버측 코드..
=====================================================Q Python2.4, IIS 5.1, WinXP환경입니다.
Win32all설치후에 Manual보고 그대로 실행했는데,
Internal Server Error : 500이 뜹니다.
그리고 pyscript.py를 그냥 실행시키면 python script가 IIS에 등록되는 것 같습니다.
위 옵션에 --unregister를 추가하면 실행자체가 안되구요.
ASPN에서도 --unregister란 옵션은 없던데... ^^;
위의 실행결과가 안 나오네요.
누구 혹시 아시는 분 Reply좀 부탁드립니다.

[펌] - http://blog.naver.com/korekiss/20034455969
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/04/09 10:19 2007/04/09 10:19
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2368

다음과 같이 해주시길 바랍니다.

< %@ Language=VBScript %>
< %
Dim UploadPath
Dim UploadPathWaterMark
Dim UploadPathThumbnail
Dim FilePath
Dim FilePath1

set uploadform=server.CreateObject("DEXT.FileUpload")

uploadform.DefaultPath="C:\Temp"

''원본 업로드(1)
UploadPath = uploadform("file").Save
Response.Write("Save as Source Image:" & UploadPath & "
")

set objImage =server.CreateObject("DEXT.ImageProc")

if true = objImage.SetSourceFile(UploadPath) then
''FileNameWithoutExt 속성은 업로드한 파일의 이름을 리턴한다.(확장자 제외)
SourceFileName = uploadform("file").FileNameWithoutExt

FilePath = "C:\Temp\" & SourceFileName & "(WaterMark).jpg"
FilePath1 = "C:\Temp\" & SourceFileName & "(Thumbnail).jpg"

''워터마크 처리(2)
UploadPathWaterMark = objImage.SaveAsWatermarkImage("/DEXTUploadProSamples/Image/WaterMark/watermark.bmp",FilePath,-10,-10,false)
Response.Write("Save as Watermark Image: " & UploadPathWaterMark & "
")
end if

if true = objImage.SetSourceFile(UploadPathWaterMark) then
''워터마킹 처리 된 이미지로 썸네일 처리 한다. (3)
UploadPathThumbnail = objImage.SaveasThumbnail(FilePath1, objImage.ImageWidth/2, objImage.ImageHeight/2, false)
Response.Write("Save as Thumbnail: " & UploadPathThumbnail & "
")
end if
%>



< %
set objImage = nothing
Set uploadform =nothing
%>
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/03/16 15:18 2007/03/16 15:18
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2326

[javascript] 이미지 리사이징

< script>
function imgRsize(img, rW, rH){
var iW = img.width;
var iH = img.height;
var g = new Array;
if(iW < rW && iH < rH) { // 가로세로가 축소할 값보다 작을 경우
g[0] = iW;
g[1] = iH;
} else {
if(img.width > img.height) { // 원크기 가로가 세로보다 크면
g[0] = rW;
g[1] = Math.ceil(img.height * rW / img.width);
} else if(img.width < img.height) { //원크기의 세로가 가로보다 크면
g[0] = Math.ceil(img.width * rH / img.height);
g[1] = rH;
} else {
g[0] = rW;
g[1] = rH;
}
if(g[0] > rW) { // 구해진 가로값이 축소 가로보다 크면
g[0] = rW;
g[1] = Math.ceil(img.height * rW / img.width);
}
if(g[1] > rH) { // 구해진 세로값이 축소 세로값가로보다 크면
g[0] = Math.ceil(img.width * rH / img.height);
g[1] = rH;
}
}
g[2] = img.width; // 원사이즈 가로
g[3] = img.height; // 원사이즈 세로
return g;
}

function gg(img, ww, hh, aL){
var tt = imgRsize(img, 400, 400);
img.width = tt[0];
img.height = tt[1];
if(aL){
img.onclick = function(){
wT = Math.ceil((screen.width - tt[2])/2.6); // 클라이언트 중앙에 이미지위치.
wL = Math.ceil((screen.height - tt[3])/2.6);
mm = window.open(img.src, 'viewOrig', 'width='+tt[2]+',height='+tt[3]+',top='+wT+',left='+wL);
mm.document.body.style.margin = 0; // 마진제거
mm.document.body.style.cursor = "hand";
mm.focus();
if(mm.document.body.onclick) mm.close(); //미해결부분
}
img.style.cursor = "hand";
}
}
// 사용법 gg(this, 400, 400, 1);
// 이미지경로, 가로크기제한, 세로크기제한, 원본새창링크


< img src='/tc/attach/image/465544.jpg' onload='gg(this, 400, 400, 1)'>

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기

Posted by 홍반장

2007/03/16 11:46 2007/03/16 11:46
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/2325

« Previous : 1 : ... 15 : 16 : 17 : 18 : 19 : 20 : 21 : 22 : 23 : ... 33 : Next »

블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/11   »
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Statistics Graph

Site Stats

Total hits:
243888
Today:
239
Yesterday:
776