Latest developer linksBookmark and Share
 
HomeThis WeekTop MonthTop AlltimeSearchRegisterFAQ
  
 
Submit Your Link
Please login to submit your Link
 

Found website thumbnail generator but need to adjust code

Posted: Dec/26/2010   By: nikhil   Points:15   Category: .NET  - ASP.Net    Views:50   Vote Up (0)   Vote Down (0)    

My site is a directory and I'm really tired of manually fetching each and every thumbnail for each website.

I found this code, but it produces bmp files.  I looked at this and I see Bitmap... Is it possible that this can be modified to produce

jpgs? My goal is to get it to get the picture of the site, then resize it and save it into a subdirectory as a jpg file with the to include:

www.domain.com.jpg

 That's how all my thumbnails are now. Is this possible given the Bitmap issue?  How does Alexa generta the jpg for their files?  Do they start with a bmp?

 Here's the code:

WebsiteThumnailImage.aspx

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="WebsiteThumbnailImage.aspx.cs" Inherits="WebsiteThumbnail.WebsiteThumbnailImagePage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Website Thumbnail Image Generator</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td >
                    <asp:TextBox ID="txtWebsiteAddress" runat="server" Width="415px">www.google.com</asp:TextBox> </td>
                <td >
                     <asp:Button ID="btnShowThumbnailImage" runat="server" Text="Show Thumbnail Image" OnClick="btnShowThumbnailImage_Click" /></td>
            </tr>
            <tr>
                <td>
                    Width:
                    <asp:TextBox ID="txtWidth" runat="server">200</asp:TextBox>
                     Height:
                    <asp:TextBox ID="txtHeight" runat="server">200</asp:TextBox></td>
                <td>
                </td>
            </tr>
            <tr>
                <td colspan="2" style="height: 32px">
                    <asp:Image ID="imgWebsiteThumbnailImage" runat="server" Visible="false"/></td>
            </tr>
        </table>    
    </div>
    </form>
</body>
</html>
 

WebsiteThumbnailImage.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.W
                          
                               

View Complete Post


Comments:
Be the first to comment this post.
 
Post Comment
Please login to post your comment
More Related Resources

How do I get the datakey for a DataControlRowType.DataRow when a TemplateField is created in code behind?

  

Hi, i'm new to this and I've been stuck for a while on this one.
I would like to retreive the data key (au_id) when the rowType = DataRow, so I can do a Sub query with the datakey Id. 

thank you for your help.

 

I'm using this Microsoft Example:

<%@ Page language="C#" %> <script runat="server">
 
  // Create a template class to represent a dynamic template column.
  public class GridViewTemplate : ITemplate
  {
    private DataControlRowType templateType;
    private string columnName;
  
    public GridViewTemplate(DataControlRowType type, string colname)
    {
      templateType = type;
      columnName = colname;
    }

    public void InstantiateIn(System.Web.UI.Control container)
    {
      // Create the content for the different row types.
      switch(templateType)
      {
        case DataControlRowType.Header:
          // Create the controls to put in the header
          // section and set their properties.
          Literal lc = new Literal();
          lc.Text = "<B>" + columnName + "</B>";
         
          // Add the controls to the Controls collection
          // of the container.
          container.Controls.Add(lc);
          break;
        case DataControlRowType.DataRow:

 

         //  GET au_id DataKey Here

 


          // Create the controls to put in a data row
          // section and set their properties.
          Label firstName = new Label();
          Label lastName = new Label();
         
          Literal spacer = new Literal();
          spacer.Text = " ";
         
          // To support data binding, register the event-handling methods
          // to perform the data binding. Each control needs its own event
          // handler.
          firstName.DataBinding += new EventHandler(this.FirstName_DataBinding);
          lastName.DataBinding += new EventHandler(this.LastName_DataBinding);
         
 &nb

In VB.Net - how to login on a website and access another page maintaining the session

  

Have a project where I need to access a RSS feed.   The issue is this RSS feed, you need to be logged in as a user.   They have a simple web form (login + password).   How do I?

1) Post a web form with my login and password

2) Maintaining Session (w/successful login), do an additiional GET to retrieve the RSS feed.

I am doing this in an ASP.Net page so it all happens server side in VB.Net

Brian 


how can ifind the panel ID in code behind

  
<asp:panel id="panel1" runat="server">
      <asp:panel id="panel2" runat="server">
                  <asp:textbox id="textid" runtat="server"

                  </asp:panel>
         </asp:panel>


how i can find the panel id in code behind if i know id="textid

my output

<panel1>

         <panel2>

                    <textid>        aaaaaa</textid>

</panel2>

</panel1>


AdditionalFields can not be found issue at client.

  

If the element name in AdditionalFields can not be found, the value will be "undefined". 

I think it'd better to be null or String.Empty, isn't it?


NerdDinner source code help please - Map related

  

My map has gone funny for some reason.

It can translate addresses into coordinates in the submissions page, but then JSON translates everything to 0,0 coordinates when the event is saved.

Map

All help is much appreciated: I have no idea what's causing this.

Many thanks,

Tim


Find dom element starting from found element in same TR

  

Hello all,


I would like to select an element that is in the same TR as another element I found with a selector.

The selector itself: $("input[name='sMessageValue']","#messageTable")

Now I have this element and got its value I would like to find a checkbox located in the same TR, i tried this as starting point : $(this).(':parent').val(). But seems not the right thing to do.


Thank you,


storing javascript code in a label

  

Hi,

 I recently came across some code where an asp:label was storing some javascript code. The code was being used to open another aspx page with window.open, and set the height, width, etc.  I have never seen this before. What is the reason for using this type of navigation (javascript) rather than using asp.net or vb code? Also, what is the purpose of putting the code in a label, rather than just in the <head> section?

thanks.



I need to edit this code please

  

Hello sir ..

I have dropdown list which let me hide or show some field using javascript in C#

protected void Page_Load(object sender, EventArgs e)
    {
	JournalPanel.Style.Add("display", "none");
	script += "var Panel = document.getElementById('" + JournalPanel.ClientID + "');";
	script += "if(document.getElementById('" + DropDownList1.ClientID + "').selectedIndex==1)";
	script += "Panel.style.display=''; else Panel.style.display='none';";
	DropDownList1.Attributes.Add("onChange", script);
}


above code is fine , but when i add to it something like :

	JournalPanel.Style.Add("display", "none");
	script += "var Panel = document.getElementById('" + JournalPanel.ClientID + "');";
	script += "if(document.getElementById('" + DropDownList1.ClientID + "').selectedIndex==1)";
    script += "Panel.style.display='';ValidatorEnable(document.getElementById('" + RequiredFieldValidator6.ClientID + "'),false);";
    script += "else Panel.style.display='none';";
    DropDownList1.Attributes.Add("onChange", script);


 

 

It did not work ...can you correct it please ??

actually i need the same dropdown list hide or show some field and at the same time it disable some required field validator

using 

ValidatorEnable(document.getElementById('"

+ RequiredFieldValidator6.ClientID + "'),false);";

any idea please ????


Can't Debug Website Locally

  

Novice here.

Recently got a new (used) machine and had to reinstall VS 2008 - may or may not be related. Yesterday, I opened an existing website via Source Control. I can check files in and out and make edits, but when I try to debug locally, I get a list of errors, starting with:

"Could not load file or assembly 'System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified."

Everyone else working on this website is able to deploy it locally. Also, if I create a new website, I can debug just fine, and I used to be able to edit and debug other sites. Everything I've found by Googling this error so far has to do with MVC projects, and suggests changing the webconfig or other files. Since other people can run this, it seems it must be a problem with my software, not the code.

Any ideas?


Multilanguage website

  

What is the best option or different options to create a multilingual website?

Exploit the themes?

I have three languages:

  • Three templates
  • Content in one language should link to content in the other language
  • Images are the same content, but they have different filenames (SEO)

The current website has two languages, but I want to add English ( http://www.huurvillafrankrijk.be/ )


 
Categories:
.NET
Java
PHP
C/C++/VC++
HTML/XML
SAP
MainFrames
Data Warehousing
Testing
MySQL
SQL Server
Oracle
Javascript/VB Script
Others
Login
 
 
 
 
 Forgot password
 Contact Us   Terms Of use   Share your knowledge