GenoPro Home
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 

GenoPro Support Forum




Picture aspect ratio in HTML reports

Click to view RSS...
Author Resizing images in the reports
Posted Thursday, August 18, 2005 - Post #7061
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
Yep, I think a popup displaying the picture description is the solution. If you want to build a complex hyperlink with a onClick() event handler, you may have write your own routine to for the img tag or a tag. The method PictureDimension is very versatile, as you can get the raw picture dimension if you pass an empty string for strDimensionMax. You can get the widh or height by using the formatting template "{0}" and "{1}" respectively.

The methods WritePicture and ToHtmlHyperlinkPicture are shortcuts to write code faster. If you need a complex hyperlink, it is likely you will have to write your own function (sub-routine) to format the hyperlink. What I can do is analyze your code and later "optimize" it by writing a specialized routine.
Posted Thursday, August 18, 2005 - Post #7060
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 2 days ago @ 9:23 PM
Posts: 3,464, Visits: 26,854
Yes I think can see now that I can use strAttributesHtml in conjunction with the PictureDimension method to calculate the required vspace & hspace values.

Update: I've since discovered vspace & hspace are deprecated. I'll need to use style values for margin instead.

However the other attributes, i.e. target='_blank' and onClick='..' need to be applied to the anchor tag and not the img tag. Also the anchor tag href attribute may need to be accessible to implement rjn's requirement or other autosize methods. However I haven't managed to get the autosize popup to work as yet, so perhaps you should take no action on this at the moment.



'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"
Posted Thursday, August 18, 2005 - Post #7059
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Moderators
Customers
Gamma
FamilyTrees.GenoPro.com
Translator
GenoPro version: 3.1.0.1

Last Login: Tuesday, October 28, 2025
Posts: 4,886, Visits: 22,799
The features you are asking are already there (I think). I need to update the documentation so you can use those features. In summary, all three methods Report.WritePicture, oPicture.ToHtmlHyperlinkPicture and oPicture.PictureDimension have a parameter to add additional attributes.

Report.WritePicture(oPicture, strDimensionMax, strAttributesHtml)

oPicture.ToHtmlHyperlinkPicture(strDimensionMax, strAttributesHtml, strDescription)

oPicture.PictureDimension(strDimensionMax, strFormatTemplate)

The strAttributesHtml is anything extra you want to include within the anchor tag. The strFormatTemplate is a format template similar to Util.FormatString where {0} and {1} are the width and height of the picture. If no parameter is specified, GenoPro uses the template "{0}x{1}" to produce a string of format "123x145" to describe the picture dimension.

You can therefore use the following:
strPicture = oPicture.PictureDimension("150x150", "width={0} height={1}")

I will update the documentation later today.
Posted Thursday, August 18, 2005 - Post #7058
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 2 days ago @ 9:23 PM
Posts: 3,464, Visits: 26,854
My solution will put the image in the top left of a blank white page. To overcome this an autosized window is needed which can be achieved with another bit of Javascript. An example can be found here http://www.therotunda.net/code/autosized-popup-window.html. This requires an additional attribute, onClick="viewPic(this.href); return false;", for the anchor element as well as the target attribute. Perhaps Dan could add this to the methods as well.

The required Javascript is reproduced below.
function viewPic(img)
{
picfile = new Image();
picfile.src =(img);
fileCheck(img);
}

function fileCheck(img)
{
if( (picfile.width!=0) && (picfile.height!=0) )
{
makeWindow(img);
}
else
{
funzione="fileCheck('"+img+"')";
intervallo=setTimeout(funzione,50);
}
}

function makeWindow(img)
{
ht = picfile.height + 18;
wd = picfile.width + 18;

var args= "height=" + ht + ",innerHeight=" + ht;
args += ",width=" + wd + ",innerWidth=" + wd;
if (window.screen)
{
var avht = screen.availHeight;
var avwd = screen.availWidth;
var xcen = (avwd - wd) / 2;
var ycen = (avht - ht) / 2;
args += ",left=" + xcen + ",screenX=" + xcen;
args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=yes";
}
return window.open(img, '', args);
}


An extra parameter would be needed to provide the choice between displaying the picture and displayed the related individual's report page.



'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"
Posted Thursday, August 18, 2005 - Post #7057
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Forum Members

Last Login: Wednesday, August 17, 2005
Posts: 24, Visits: 0
Also if the image is clicked the full image is displayed in the same frame (i.e. detail.htm). My preference is for the image to be displayed in a new window. This can be achieved by adding the target='_blank' attribute to the anchor element.


This would be excellent and probably easy to apply enhancement. It's quite irritating when pictures displays in the upper-left corner on a blank white page.
Still I'd like an option to navigate with pictures i.e. clicking on the picture opens the individual (or such) page instead of picture file itself on browser.
Posted Monday, July 4, 2005 - Post #7056
Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master

Administrators
Customers
Important Contributors
FamilyTrees.GenoPro.com
GenoPro version: 3.1.0.1

Last Login: 2 days ago @ 9:23 PM
Posts: 3,464, Visits: 26,854
Currently if the pictures have different height/width ratios then the text 'jumps' when the slide show is activated. This can be avoided if the image is padded out to the maximum dimensions using either vspace or hspace attributes of the html img element. e.g. for main pictures (248 x 248), if width of resized image is 173 say, then add hspace='37.5' to the genenerated html for the image (both in main area and select/option values). Similarly if resized height was say 152 then add vspace='48' attribute to img element.

Also if the image is clicked the full image is displayed in the same frame (i.e. detail.htm). My preference is for the image to be displayed in a new window. This can be achieved by adding the target='_blank' attribute to the anchor element.

So may I request that the methods Report.WritePicture and <genoobject>.ToHtmlHyperlinkPicture are amended so that the above are added either as defaults or as extra parameter options?

Another niceity would be for the Report Generator to reduce the file size of images by increasing JPEG compression ('save for Web') and also perhaps resizing the images when required to a user specified size. This would only be applied to images copied by the Report Generator to the 'pictures' folder, not the original images. Perhaps this could be included in version 3 if not possible for 2.



'lego audio video erro ergo disco' or "I read, I listen, I watch, I make mistakes, therefore I learn"


Edited: Thursday, June 8, 2006 by GenoProSupport


Similar Topics

Click to view RSS...
Expand / Collapse

Reading This Topic

Expand / Collapse