Image Manipulation

  • I asked the other day about exporting image data to a physical file via T-SQL. Eventually I sorted it with a BCP call.

    Now my client (that thinks it's a good idea to store images in the database, so there's the benchmark for their knowledge and experience :crazy wants me to create a thumbnail for the images they store.

    The basic premise is this: A shed load of data and a requirement for a static website that is generated every night as flat html files from the database. I'm doing this currently, but as the images they are holding are..lets say 'unusually shaped'... I can't create a standard size for the thumbnail and stuff the image into the page.

    What I need is a method by which I can 'read' the dimensions of the file and scale the thumbnail down based on these values.

    Oh, and it has to run from a standard sp without any calls to DTS packages. I can get away with OA calls, but aisde from that it's good ole' SQL all the way. (remind me a gain why I do this job? :crazy

  • Hi Tim can you clarify... Is the question "create a thumbnail image from an image i have so I can either use the thumbnail or save it in the db?" why do you need the dimensions again? could you simply use a .NET method to create a thumbnail of 100px x 100 px from any image? can we use some scaling formula (ie height always 100 Height > width else width always 100 ?

    I've done every slice of what you want to do, and can give an example, but I needed to know the end result;

    codeproject has lots of examples for thumbnail generation, it's just adapting it a bit:

    http://www.codeproject.com/csharp/thumbgenerator.asp

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi Lowell,

    Nope. The question is, how do I create a thumbnail from a randomly shaped image that is stored as binary image data without using .net or anything other than a stored procedure?

    I get the images out of the db at the moment using a call from within the sp to bcp. However, this creates the file as a image in it's original dimensions. What I need to do is create a proportional thumbnail image that I can output with the correct dimensions.

    .net is no use to me as this has to be classic stored procedures that run on a SQL 2000 box. No DTS. No .net. No cmd line calls to vb routines. No nothing, but good ole' Squirrel Server.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply