Picture aspect ratio in HTML reports
GenoPro Home  |  Get Started With My Genealogy Tree  |  Buy  |  Login  |  Privacy  |  Search  |  Site Map
 
GenoPro Support Forum
Home        Members    Who's On
Welcome Guest ( Login | Register )
        



Picture aspect ratio in HTML reports Expand / Collapse
Author
Message
Post #7056 Posted 7/4/2005 6:45:46 PM


Grand Master

Grand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand Master This user is a contributor to FamilyTrees.GenoPro.com This user is an important contributor to the GenoPro community 

Group: Customers
Last Login: Today @ 8:14:43 AM
GenoPro Version: 2.0.1.6
Posts: 1,151, Visits: 5,403
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"
Post #7057 Posted 8/18/2005 6:49:22 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 8/17/2005 10:23:14 PM
Posts: 48, 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.
Post #7058 Posted 8/18/2005 6:49:22 PM


Grand Master

Grand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand Master This user is a contributor to FamilyTrees.GenoPro.com This user is an important contributor to the GenoPro community 

Group: Customers
Last Login: Today @ 8:14:43 AM
GenoPro Version: 2.0.1.6
Posts: 1,151, Visits: 5,403
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"
Post #7059 Posted 8/18/2005 6:49:22 PM


Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master This user is an important contributor to the translation of GenoPro 

Group: Administrators
Last Login: Today @ 8:36:29 AM
GenoPro Version: 2.4.0.3
Posts: 3,523, Visits: 14,877
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.


Post #7060 Posted 8/18/2005 6:49:23 PM


Grand Master

Grand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand MasterGrand Master This user is a contributor to FamilyTrees.GenoPro.com This user is an important contributor to the GenoPro community 

Group: Customers
Last Login: Today @ 8:14:43 AM
GenoPro Version: 2.0.1.6
Posts: 1,151, Visits: 5,403
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"
Post #7061 Posted 8/18/2005 6:49:23 PM


Legendary Master

Legendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary MasterLegendary Master This user is an important contributor to the translation of GenoPro 

Group: Administrators
Last Login: Today @ 8:36:29 AM
GenoPro Version: 2.4.0.3
Posts: 3,523, Visits: 14,877
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.


« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: GenoProSupport, JcMorin, Ron

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 6:43 PM

Copyright 1998-2008 GenoPro. All rights reserved. GenoPro and the GenoPro logo are trademarks.