//  home   //  advanced search   //  news   //  categories   //  sql build chart   //  downloads   //  statistics
 ASP FAQ 
Home
ASP FAQ Tutorials

   8000XXXX Errors
   Alerts
   ASP.NET 2.0
   Classic ASP 1.0
      COM / ActiveX Components
      Forms
      General Topics
      Date/Time Routines
      Email Scripts & Info
      Files/Directories & FSO
   Databases
   General Concepts
   Search Engine Optimization (SEO)

Contact Us
Site Map

Search

Web
aspfaq.com
tutorials.aspfaq.com
classicasp.aspfaq.com

ASP FAQ Tutorials :: Classic ASP 1.0 :: Files/Directories & FSO :: How do I create / manipulate images from ASP?


How do I create / manipulate images from ASP?

There are a few components that allow you to do this; here are two of them: 
 
    ShotGraph 
 
    ASPImage 
 
The following components are specialized for creating charts and/or graphs from ASP: 
 
    ASPGFX 
 
    ChartDirector 
 
    Chart FX 
 
    DundasChart 
 
    IntrChart 
 
    PopChart Image Server 
 
The following free component will tell you the properties of a local image file: 
 
    ImageSize 
 
Finally, you can determine the dimensions of an image without a component. If you are running Windows XP or Windows Server 2003, see Article #2296. Otherwise, see this article on LearnASP.com: 
 
    http://www.learnasp.com/learn/graphicdet... 
 
I found this script a bit buggy with JPG files produced by certain filters in Photoshop, and some readers have reported that images with width and/or height >= 1000 pixels are not reported correctly. Also, thanks to Bryan O'Malley and Thomas Honoré Nielsen, here is a correction of the ReadJpg function from the above link: 
 
Function ReadJPG(file) 
    Const maxJpegSearch = 2048 
    Dim fso, ts, s, HW, nbytes, x, SOF 
    HW = Array("","") 
    Set fso = CreateObject("Scripting.FileSystemObject") 
    Set ts = fso.OpenTextFile(Server.MapPath("/" & file), 1) 
    s = ts.Read(maxJpegSearch) 
    ts.Close 
    for x = 1 to Len(s) - 1 
        if Asc(Mid(s, x, 1)) = &hFF then 
            if Asc(Mid(s, x + 1, 1)) >= &hC0 AND _ 
            Asc(Mid(s, x + 1, 1)) <= &hCF AND _ 
            Asc(Mid(s, x + 1, 1)) <> &hC4 then 
                SOF = x 
                exit for 
            end if 
        end if 
    next 
    if SOF > 0 then 
        s = Mid(s, SOF + 5, 4) 
        HW(0) = HexToDec(HexAt(s,3) & HexAt(s,4)) 
        HW(1) = HexToDec(HexAt(s,1) & HexAt(s,2)) 
    else 
        HW(0) = -1 
        HW(1) = -1 
    end if 
    ReadJPG = HW 
End Function
 
And here is how the HexToDec function should look: 
 
<% 
Function HexToDec(cadhex) 
    HexToDec = CLng("&H" & cadhex) 
End Function 
%>

Related Articles

Can I include a file in both server-side and client-side script?
Can I read / write a user's file without a prompt?
Can I rename a file using FileSystemObject?
Could I get some help working with files using FileSystemObject?
How do I avoid 'the red x' when an image is missing?
How do I change the modified time of a file?
How do I dynamically include files?
How do I find the owner, author, and other properties of a file?
How do I get a list of a folder's subfolders?
How do I get the name of the current URL / page?
How do I prevent people from 'leeching' my CSS or JS files?
How do I prevent people from 'leeching' my images?
How do I retrieve a random file from a given folder?
How do I send the correct filename with BinaryWrite?
How do I sort a list of files?
How do I use FileSystemObject to create a file on the client?
Why do I get 'Disk not ready' errors with FileSystemObject?
Why do I get 'Invalid procedure call or argument'?
Why do I get 'Path not found' errors with Scripting.FileSystemObject?
Why do I get 'Permission Denied' errors with FileSystemObject?
Why do I get 800A0034 errors?
Why do I get 800A003E / Input past end of file errors?
Why do I get 800A0BBA errors?
Why do I get 800A0BBC errors?
Why do I get an 'Invalid Path Character' error?
Why do I get permissions errors after upgrading to Windows XP?
Why does FileSystemObject hang all of a sudden?
Why is 'the operation completed successfully' an error message?

 

 


Created: 7/9/2000 | Last Updated: 9/12/2005 | broken links | helpful | not helpful | statistics
© Copyright 2006, UBR, Inc. All Rights Reserved. (311)

 

Copyright 1999-2006, All rights reserved.
Finding content
Finding content.  An error has occured...