Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Affordable ASP.NET Hosting Service
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
 


  Sponsors  

Meet Our Sponsors

AspDotNetStoreFront - E-Commerce by Design - The Leading ASP.NET shopping cart platform for developers!
Click here to go to dev.live.com for Windows Live developer resources
SteadyRain
DataSprings - Great Ideas. Always Flowing.
R2integrated - formerly bi4ce
Jango Studios - Skins, Modules and Hosting for DotNetNuke
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  A page for creating thumbnails won't work
Previous Previous
 
Next Next
New Post 6/16/2008 7:03 AM
User is offline Luca CB
15 posts
10th Ranked


A page for creating thumbnails won't work 

Hi all,

I create a Thumbnail.aspx page for creating thumbnails on the fly, the problem is that the page works perfectly on any ASP.NET Application but not when i use it in my custom DDN Module and I don't understand why.

This is the page code:

 Partial Public Class ThumbnailInherits System.Web.UI.PagePrivate Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.LoadDim strPath As String = Request.QueryString("p")Dim strImg As String = Request.QueryString("i")Dim intW As Integer = Request.QueryString("w")Dim intH As Integer = Request.QueryString("h")'original image

 

 

 

 

Dim objImage As System.Drawing.Image = New Bitmap(Server.MapPath(strPath & strImg))Dim intImgW As Integer = objImage.WidthDim intImgH As Integer = objImage.Height'new width and height

 

Dim intThumbW As Integer

 

Dim intThumbH As Integer

 

If intImgW >= intW And intImgH >= intH Then

 

If intImgW > intImgH Then

intThumbW = intW

intThumbH = (intH * intImgH) / intImgW

 

Else

intThumbW = (intH / intImgH) * intImgW

intThumbH = intH

 

End If

 

ElseIf intImgW <= intW And intImgH <= intH Then

intThumbW = intImgW

intThumbH = intImgH

 

ElseIf intImgW >= intW And intImgH <= intH Then

intThumbW = intW

intThumbH = (intH * intImgH) / intImgW

 

ElseIf intImgW <= intW And intImgH >= intH Then

intThumbW = (intH / intImgH) * intImgW

intThumbH = intH

 

End If

 

'miniature

 

 

Dim objThumbImage As System.Drawing.Image'image codec info

 

 

 

 

Dim myImageCodecInfo As System.Drawing.Imaging.ImageCodecInfoDim Encoders As System.Drawing.Imaging.ImageCodecInfo() = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()For i As Integer = 0 To (Encoders.Length - 1)If (Encoders(i).MimeType = "image/jpeg") Then

myImageCodecInfo = Encoders(i)

 

End If

 

 

Next i'parameters

 

myEncoderParameters =

 

Dim myEncoderParameters As System.Drawing.Imaging.EncoderParametersNew System.Drawing.Imaging.EncoderParameters(1)'encoder quality, value compression

 

 

Dim myEncoderQuality As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.QualityDim Compression As Long

 

If Trim(Request.QueryString("c")) = "" Then

Compression = 100

 

Else

Compression =

 

Long.Parse(Request.QueryString("c"))End If

 

'quality parameter

 

myEncoderParameterQuality =

 

Dim myEncoderParameterQuality As System.Drawing.Imaging.EncoderParameterNew System.Drawing.Imaging.EncoderParameter(myEncoderQuality, Compression)'add quality parameter to parameters

myEncoderParameters.Param(0) = myEncoderParameterQuality

 

callback =

objThumbImage = objImage.GetThumbnailImage(intThumbW, intThumbH, callback, IntPtr.Zero)

 

Dim callback As System.Drawing.Image.GetThumbnailImageAbortNew System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)'crop --------------------------------------------------------------------------------------------------------------------

 

'Dim objDrawImage As New System.Drawing.Bitmap(intW, intH, Pixelformat.format24bppRgb)

 

'Dim objGraphics As Graphics = Graphics.FromImage(objDrawImage)

 

'objGraphics.CompositingQuality = CompositingQuality.HighQuality

 

'objGraphics.SmoothingMode = SmoothingMode.AntiAlias

 

'objGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic

 

'Dim intXSize As Integer = objThumbImage.Width - 1

 

'Dim intYSize As Integer = objThumbImage.Height - 1

 

'Dim intHalfWidth As Integer = intXSize / 2

 

'Dim intHalfHeight As Integer = intYSize / 2

 

'Dim X As Integer = intHalfWidth - (intW / 2)

 

'Dim Y As Integer = intHalfHeight - (intH / 2)

 

'objGraphics.DrawImage(objThumbImage, New Rectangle(0, 0, intW, intH), New Rectangle(X, Y, intW, intH), GraphicsUnit.Pixel)

 

'objThumbImage.Dispose()

 

'-------------------------------------------------------------------------------------------------------------------------

Response.ContentType =

"image/jpeg"

 

'objDrawImage.Save(Response.OutputStream, myImageCodecInfo, myEncoderParameters)

objThumbImage.Save(Response.OutputStream, myImageCodecInfo, myEncoderParameters)

objImage.Dispose()

objThumbImage.Dispose()

 

'objGraphics.Dispose()

 

'objDrawImage.Dispose()

 

 

 

Maybe the problem is the use of AJAX in my module?

Thank you for your help! :-)

End Sub 

 

 

 

 

 

 

 

 

 
New Post 6/16/2008 9:53 AM
User is offline Dario Rossa
229 posts
9th Ranked




Re: A page for creating thumbnails won't work 

Hi Luca,

what error do you receive?

Best regards,
Dario Rossa


Dario RossaDario Rossa
Personal WebSite: http://www.dariorossa.it
DotNetNuke: http://dotnetnuke.dariorossa.it
 
New Post 6/16/2008 10:19 AM
User is offline Luca CB
15 posts
10th Ranked


Re: A page for creating thumbnails won't work 

 Dario Rossa wrote

Hi Luca,

what error do you receive?

Best regards,
Dario Rossa

Hi Dario,

thank you for your answer, simply the image is not displayed. The X of not existing image is showed insted of the image.

 
New Post 6/16/2008 6:07 PM
User is offline Rodney Joyce
1450 posts
www.smart-thinker.com
6th Ranked




Re: A page for creating thumbnails won't work 

Is there any reason why you are using the Page clas and not an IHttpHandler? This is what I do on my UserProfile module:

 

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Profile : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {

            ..blurb..
        }

        public bool IsReusable
        {
            get
            {
                return true;
            }
        }
    }


Thanks,
Rodney
Smart-Thinker - Social Networking modules for DotNetNuke
The DotNetNuke Directory - Are you listed?
PokerDIY - Example Implementation of DNN Social Network
Do use DNN a lot? Try the DotNetNuke Toolbar to save you time!
 
New Post 6/16/2008 10:17 PM
User is offline eck two
322 posts
8th Ranked


Re: A page for creating thumbnails won't work 

You should view property of the red x to gain clues as to the problem which is most likely that you are calling the page at a location where it does not exist.

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  A page for creating thumbnails won't work
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Cestus Websites
DotNetNuke websites en services in Nederland. Cestus Websites levert websites, projectmanagent, skins, modules, training en gespecialiseerde hosting op basis van het CMS DotNetNuke.
www.dotnetnuke-websites.nl
FREE Skins, Modules & Control Panel!
Choose how much you want to pay on our Skins, Modules, Containers and Control Panel - Starting from FREE!
www.dnngroup.com
Disgrafic
Diseño y creación de portales web dinámicos :: Desarrollo de módulos personalizados :: Soluciones a medida :: Imagen Corporativa :: Tu proveedor DNN en España
www.disgrafic.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP