|
|
ShotGraph FAQ (part II)
Part 1 Part 2
- My image producing ASP script appears as "broken image" picture in the main HTML document. How can I understand what's wrong?
- I copied ASP example and tried to run it. But I got an broken image picture in Web browser or strange text strings.
- My text is drawn with the font different from the one specified in CreateFont
- I use javascript instead of VBscript in my ASP files. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
- I use Perl for Windows. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
- I use ShotGraph in my Visual Basic applications. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
- In some rare cases on Win2000 I see the 'error 8002801d Library not registered' error message
My image producing ASP script appears as "broken image" picture in the main HTML
document. How can I understand what's wrong?
The main tip to debug the image generating script is the following:
you should load the image producing ASP script directly in your browser
instead of refering via IMG SRC tag. The ASP operands changing the content-type of
created document should be commented out.
I copied your ASP example and tried to run it. But I got an broken image
picture in Web browser or strange text strings.
That text is "GIF89ablabla..." or "blabla JFIF blabla...", isn't it? If so,
that is the binary image data shown by browser as text. Why?
The most common mistake the people make copying the examples is they add
extra spaces and empty strings outside the <%%> tags. The ASP script producing
binary output can not have some symbols neither before nor after ASP operands.
In case of text output the additional space or new line symbol does not affect
the view of document. But in case of binary stream any additional symbols
corrupt it.
|
For example, the following script will not be working:
|
* empty string *
<%
Response.Contenttype="image/gif"
...................
Response.BinaryWrite ...
%>
* empty string *
* empty string *
|
The same error occures if you insert the image creating ASP code directly
into base ASP HTML document. Instead of direct inserting use IMG SRC
tag to refer to imaging script.
My text is drawn with the font different from the one specified in CreateFont
As a rule that means the required font name has not been found. To find the exact font name
open the ControlPanel/Fonts folder on server (ShotGraph uses server side fonts, of course) and double click the
font. In the newly opened window the property "Typeface name" shows the font name exactly as it should appear
in CreateFont.
I use javascript instead of VBscript in my ASP files. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
Javascript has some difficulties with passing parameters by reference. Both GetFileDimensions and
GetTextDimensions methods return X and Y dimensions via parameters. To avoid this problem, ShotGraph has the lastX
and lastY properties. These read-only properies are set by methods. You should read these properties just after
GetFileDimensions or GetTextDimensions call.
I use Perl for Windows. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
The Variant variables being passed to COM object's method should be previously declared in Perl.
The following code shows the example of such declaration.
|
This example shows ByRef declaration on Perl
|
my $XSize = Variant(VT_VARIANT|VT_BYREF, 0);
my $YSize = Variant(VT_VARIANT|VT_BYREF, 0);
$ImgObj->GetFileDimensions("$PicturePath\\$FileName", $XSize, $YSize);
|
I use ShotGraph in my Visual Basic applications. Unexpectly, the GetFileDimensions and GetTextDimensions methods did not return horizontal and vertical dimensions. Why?
The posible reason the variables receiving value from GetFileDimensions have no Variant type.
You should declare them as Variants
|
Example
|
' Wrong declaration was:
' Dim xsize As Long, ysize As Long
Dim xsize As Variant, ysize As Variant
filetype = g.GetFileDimensions(filepath, xsize, ysize)
|
In some rare cases on Win2000 I see the 'error 8002801d Library not registered' error message
If you try to run ASP script contaning ShotGraph object calls and see this ASP run-time
error message, this usually means the NT user account of ASP process has no enougn permissions to use ShotGraph module.
The best way to check this assumption is to run small .VBS script using shotgraph under your account having
administrative privileges. If script
runs successfully, the reason is in the security settings.
There are two things to check:
- Permissions for shotgraph.dll file located in the System32 directoty
-
Give at least 'Read' permission for everyone.
- Permissions for registry keys
-
- Run Regedt32
- Find the key
HKCR\ TypeLib\ {3D98D473-AC62-11D1-8558-0000C050C497}
- From Security menu select Permission, give at least 'Read' permission for everybody
|
|