rotera bild med dimac image

ASP

2 svar · 229 visningar · startad av doggelito

Medlem sedan juni 20003 076 inlägg
Trådstart#1

nån som använder denna komponent?
jag får inte med hela texten när jag roterar.

Dim imageobj, fontobj, Heading, Width, Height
set imageobj = Server.CreateObject("W3Image.Image")

Heading = Request.QueryString("Heading")

imageobj.CreateEmptySurface 1,1

Set fontobj = imageobj.CreateFont("Arial", 20, 0, "bold", 0, &H00dbdbdb&, false, false, true)
imageobj.SetFont(fontobj)

Width = imageobj.GetTextWidth(Heading)
Height = imageobj.GetTextHeight(Heading)

imageobj.CreateEmptySurface Width,Height
imageobj.SetFont(fontobj)
imageobj.DrawText Heading, 0, 0

imageobj.Rotate 90, Width/2 , Height/2

imageobj.StreamImage Response, "JPG", 24
Medlem sedan dec. 20003 887 inlägg
#2

Såg inga konstigheter när jag kollade på W3Image.Image, men jag skulle gissa på att ytan blir fel, när du tar ut Width och Hieght. Du kan ju testa en annan lösning:

Dim imageobj, drawArea, fontobj, Heading, Width, Height
Set imageobj = Server.CreateObject("W3Image.Image")

imageobj.CreateEmptySurface 1, 1

fontobj = imageobj.CreateFont("Arial", 20, 0, "bold", 0, &H00dbdbdb&, false, false, true)

imageobj.SetFont fontobj

Heading = Request.QueryString("Heading")
Width = imageobj.GetTextWidth(Heading)
Height = imageobj.GetTextHeight(Heading)

imageobj.Stretch Width, Height [blue]'Istället för en ny tom bild...[/blue]

imageobj.DrawText Heading, 0, 0
imageobj.Rotate 90, CInt(Width / 2), CInt(Height / 2)
imageobj.StreamImage Response, 'JPG', 24
Medlem sedan juni 20003 076 inlägg
#3

Hittat en lösning! :)

Dim imageobj, drawArea, fontobj, Heading, Width, Height
Set imageobj = Server.CreateObject("W3Image.Image")

imageobj.CreateEmptySurface 200, 200

Set fontobj = imageobj.CreateFont("Arial", 20, 0, "bold", 0, &H00dbdbdb&, false, false, true)
imageobj.SetFont fontobj

Heading = Request.QueryString("Heading")
Width = imageobj.GetTextWidth(Heading)
Height = imageobj.GetTextHeight(Heading)

imageobj.DrawText Heading, 0, 0
imageobj.Rotate 90, 15,15
imageobj.crop 0,0,Height,Width

imageobj.StreamImage Response, "JPG", 24
252 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
122 ms — deklarationer (db)
0 ms — hämta statistik (cache)
126 ms — hämta tråd, inlägg och bilagor (db)
120 ms — ändringar (db)