in

dashCommerce

An ASP.NET Open Source e-Commerce Application

Thumbnails

Last post 03-24-2008 12:31 PM by Timmey. 25 replies.
Page 2 of 2 (26 items) < Previous 1 2
Sort Posts: Previous Next
  • 03-18-2008 10:55 AM In reply to

    Re: Thumbnails

    That´s just what I want Big Smile

    I will try to call from another master page

  • 03-18-2008 10:58 AM In reply to

    Re: Thumbnails

    How do I rewrite this image code from DashCommerce SummaryTopDisplay.ascx?

    <img src="<%=product.ImageFile%>"name="imgTH"  id="imgTH" onclick="return img1_onclick()" height="358" width="320" />

  • 03-18-2008 11:03 AM In reply to

    Re: Thumbnails

    <img src="module/products/imagehandler.ashx?r=1&src=<%=product.ImageFile%>"name="imgTH"  id="imgTH" onclick="return img1_onclick()" height="358" width="320" />

    module/products = path to your imagehandler

    *Freetime Freestyle DashCommerce development*

    Currently working on:
    ##############################################################
    · TagCloud - patching
    · Headline Generator 50%
    · Navigation XHTML with Images 80%
    · Extended Shopping Cart Widget - 5%
    · XML Sitemap Service Exporting for Google, Froogle what ever. 33%
    - JQuery Implementing for better JLib Support 70%
  • 03-18-2008 11:11 AM In reply to

    Re: Thumbnails

    Ok, I am not sure about this part:

    public void ImageResize(HttpContext context )

    {

    Image sourceImage = GetImageFromURL("http://www.ergona.se" + context.Request["images/productimages/"]);

     

    double width = (context.Request["width"] != null) ? Convert.ToInt32(context.Request["width"]) : 100;

     

    Is this right?

     

    The images wont show up:

     http://www.ergona.se/product/b5288278-d54f-447f-9ac6-9aff0820d1b9.aspx

     

  • 03-18-2008 11:24 AM In reply to

    Re: Thumbnails

    Okay, I guess we have a problem.

    I'm going to write the service asap expli. for this page and provide a download with this file which you can use and include in your project.

    I'm sorry this is going to be tomorrow morning.

    Providing you the Service and Url for use.

    *Freetime Freestyle DashCommerce development*

    Currently working on:
    ##############################################################
    · TagCloud - patching
    · Headline Generator 50%
    · Navigation XHTML with Images 80%
    · Extended Shopping Cart Widget - 5%
    · XML Sitemap Service Exporting for Google, Froogle what ever. 33%
    - JQuery Implementing for better JLib Support 70%
  • 03-18-2008 1:20 PM In reply to

    Re: Thumbnails

    Sure! No problems! Thank you!

  • 03-19-2008 2:59 PM In reply to

    Re: Thumbnails

    Hi,

    Have been trying yesterday and all day today....but no positive result...Indifferent

    let me know if you have time to fix that code, I would really appretiate it.

    Thanks! 

     

  • 03-21-2008 7:04 AM In reply to

    • zx10
    • Top 500 Contributor
    • Joined on 03-06-2008
    • Posts 2

    Re: Thumbnails

    Hi @ernestorios did you get it sorted? if not take a look at this link:
    http://www.codeproject.com/KB/web-image/thumbnailer.aspx

    Smile

  • 03-21-2008 8:07 AM In reply to

    Re: Thumbnails

    Okay here we go:

    Create a file called ImageService.ashx

    Copy and Paste the Code from BEGIN: to :END into the file

    BEGIN:

    <%@ WebHandler Language="C#" Class="ImageService" %>

    using System;

    using System.Web;

    using System.Collections.Generic;

    using System.Drawing;

    using System.Drawing.Drawing2D;

    using System.Drawing.Imaging;

    using System.Net;

    using System.IO;

    public class ImageService : IHttpHandler

    {

    public void ProcessRequest(HttpContext context)

    {

    if (context.Request["type"] != null && context.Request["type"] == "r")

    ImageResize(context);

    // add logic for other features such like Headline generated etc.

    }

    public void ImageResize(HttpContext context )

    {

    Image sourceImage = GetImageFromURL(context.Request.Url.AbsoluteUri.Substring(0, context.Request.Url.AbsoluteUri.ToString().IndexOf("ImageService")) + context.Request["src"].Substring(1, context.Request["src"].Length-1));

     

    double width = (context.Request["width"] != null) ? Convert.ToInt32(context.Request["width"]) : 100;

    double sizeFactor = width / sourceImage.Width;

    double newHeigth = sizeFactor * sourceImage.Height;

    Bitmap newImage = new Bitmap((int)width, (int)newHeigth);

    using (Graphics g = Graphics.FromImage(newImage))

    {

    g.InterpolationMode =
    InterpolationMode.HighQualityBicubic;g.DrawImage(sourceImage, new Rectangle(0, 0, (int)width, (int)newHeigth));

    }

    newImage.Save(context.Response.OutputStream, System.Drawing.Imaging.
    ImageFormat.Jpeg);

    }

    private static Image GetImageFromURL(string url)

    {

    HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);

    HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse();

    Stream stream = httpWebReponse.GetResponseStream();

    return Image.FromStream(stream);

    }

    public bool IsReusable

    {

    get

    {

    return false;

    }

    }

    }

     

    :END

    The Url which Calls it is case senstive!

    The image src sounds like this:

    http://localhost/ImageService.ashx?type=r&src=~/repository/content/sample.jpg

    >Test it and give some feedback pls.

    Cheers

    Timmey

    *Freetime Freestyle DashCommerce development*

    Currently working on:
    ##############################################################
    · TagCloud - patching
    · Headline Generator 50%
    · Navigation XHTML with Images 80%
    · Extended Shopping Cart Widget - 5%
    · XML Sitemap Service Exporting for Google, Froogle what ever. 33%
    - JQuery Implementing for better JLib Support 70%
  • 03-24-2008 2:17 AM In reply to

    Re: Thumbnails

    YESSSSS!!!!!

    THANK YOU,THANK YOU!!!

    It works perfect!!Big Smile

    Finally....I have been struggling with this for 3 months....

    Have a great day!

    Best regards

    Ernesto 

     

  • 03-24-2008 12:31 PM In reply to

    Re: Thumbnails

    ;)

    Glad that I could help you out ;)

    Enjoy and happy easter

    Timmey

    *Freetime Freestyle DashCommerce development*

    Currently working on:
    ##############################################################
    · TagCloud - patching
    · Headline Generator 50%
    · Navigation XHTML with Images 80%
    · Extended Shopping Cart Widget - 5%
    · XML Sitemap Service Exporting for Google, Froogle what ever. 33%
    - JQuery Implementing for better JLib Support 70%
Page 2 of 2 (26 items) < Previous 1 2