Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

A Prototype of Mobile Client for E-commerce Application

, 30 Jul 2011 BSD
e-Commerce client application running on Android, Symbian, Samsung bada and Windows Mobile

Editorial Note

This article appears in the Third Party Products and Tools section. Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising.

eShop-server-simul.zip
1.jpg
eShop.zip
eShop
.platforms
android
icon.png
splash.png
bada
Icon.png
Splash.png
symbian
icon.svg
splash.png
wm
splash.png
button.ms
header-img.jpg
homeView.ms
loading.png
main.ms
productView.ms
server.ms
eShop.app
eShop.msp
SegoeWP-Black.ttf
SegoeWP-Bold.ttf
SegoeWP-Light.ttf
<%@ Page Language="C#" AutoEventWireup="true" Theme="" ContentType="image/jpeg" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>

<script runat="server">
    void Page_Load()
    {
        try
        {
            Response.Clear();
            string productId = Request["id"];
            string path = Server.MapPath(Path.GetDirectoryName(Request.Path)) + "\\" + Request["id"] + ".jpg";
            Bitmap bmp = CreateThumbnail(path, Int32.Parse(Request["w"]), Int32.Parse(Request["h"]));
            bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
            bmp.Dispose();
        }
        catch (Exception ex)
        {
            Response.StatusDescription = ex.Message;
        }
    }

    public static Bitmap CreateThumbnail(string lcFilename, int lnWidth, int lnHeight)
    {

        System.Drawing.Bitmap bmpOut = null;
        Bitmap loBMP = new Bitmap(lcFilename);
        ImageFormat loFormat = loBMP.RawFormat;

        decimal lnRatio;
        int lnNewWidth = 0;
        int lnNewHeight = 0;

        if (loBMP.Width < lnWidth && loBMP.Height < lnHeight)
            return loBMP;


        if (loBMP.Width > loBMP.Height)
        {
            lnRatio = (decimal)lnWidth / loBMP.Width;
            lnNewWidth = lnWidth;
            decimal lnTemp = loBMP.Height * lnRatio;
            lnNewHeight = (int)lnTemp;
        }
        else
        {
            lnRatio = (decimal)lnHeight / loBMP.Height;
            lnNewHeight = lnHeight;
            decimal lnTemp = loBMP.Width * lnRatio;
            lnNewWidth = (int)lnTemp;
        }

        bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
        Graphics g = Graphics.FromImage(bmpOut);
        g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
        g.FillRectangle(Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
        g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);

        loBMP.Dispose();
        
        return bmpOut;
    }    
</script>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The BSD License

Share

About the Author

Moscrif
Moscrif
Slovakia Slovakia
No Biography provided
Group type: Organisation

23 members

Follow on   Twitter

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 30 Jul 2011
Article Copyright 2011 by Moscrif
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid