Page 1 of 1
Resize Cumulus graphs for web page?
Posted: Sun 15 Jan 2012 8:35 am
by duke
As probably most of you have read I am gradually working through my 1st (

) php website.
To make it "appear" complete while I work on other pages I thought I would "borrow" the code from the Cumulus graphs & trends pages for my own page but they appear way too big. How do I scale them down?
http://www.nightingaleweather.co.uk/graphs.php
Duke
Re: Resize Cumulus graphs for web page?
Posted: Sun 15 Jan 2012 9:23 am
by mcrossley
I think you would be best using a combination of two techniques. Firstly the large graphs, iirc Cumulus has an option to rescale them on the Internet settings page, but this does not affect the thumbnails.
The thumbnails you can rescale client side by just specifying the image width/height in the <IMG> tag - you can do this for the main graphs as well of course.
there are options of using PHP to rescale the images if you wish to research that.
Re: Resize Cumulus graphs for web page?
Posted: Sun 15 Jan 2012 9:43 pm
by duke
Thanks. Worked perfectly.
Re: Resize Cumulus graphs for web page?
Posted: Sun 22 Jan 2012 6:05 pm
by TNETWeather
In that you are using XHTML as your document type, you should learn to use CSS to control your elements instead of using width and height in your img tags since those really are not proper.
In your CSS: you could define a class like:
Code: Select all
.graphimg { width: 174px; height: 54px; }
then when you use HTML code to define your images you can use the class info.
Instead of:
Code: Select all
<img src="thermometer.php"
height="170" width="54"
alt="Current temperature, daily max/min"
title="Current temperature, daily max/min" />
Use:
Code: Select all
<img class="graphimg" src="thermometer.php"
alt="Current temperature, daily max/min"
title="Current temperature, daily max/min" />
Along with CSS being the proper way to do this when using the doc type you are using for your pages, it also makes making adjustments much much easier in the future. You can now change the size used for those images on the fly by simply making one edit to your CSS and they all will adjust.
So a change of:
Code: Select all
.graphimg { width: 150px; height: 50px; }
Would change what the browsers use for sizing for all the images that have that CSS tag referenced in them.
Re: Resize Cumulus graphs for web page?
Posted: Mon 15 Oct 2012 6:47 pm
by duke
I know this is an old post but rather than start a new topic, what is the "standard" size that Cumulus uploads the graph image at? There seems to be a lot of people resizing with the most common sizes being 750px x 300px and 923px x 369px which seems an odd size

Re: Resize Cumulus graphs for web page?
Posted: Mon 15 Oct 2012 6:51 pm
by steve
The large graphs are 750x300 and the thumbnails are 150x100.
Re: Resize Cumulus graphs for web page?
Posted: Mon 15 Oct 2012 6:57 pm
by duke
Ok, thanks Steve, that is what I thought. But, strangely, the Cumulus that I have just installed (a few minutes ago) on my local server is producing graphs of 923px x 369px. It is a fresh install on a fresh drive without any alterations to Cumulus. Not even a PWS connected.
EDIT: and for my smaller images I am getting 185px x 123px

Re: Resize Cumulus graphs for web page?
Posted: Mon 15 Oct 2012 9:02 pm
by steve
Sorry, I don't know. On both of my PCs, running different version of Windows at different resolutions, I get images at the intended default size.