Getting image size through template? - google-maps

I have a template on my wiki that I use to put in image side by side with an image of a location. The issue that I am having is that if the image (which is often taken from a movie screenshot) has a different ratio (say it is a wide screen 16:9) then there is a bunch of white space above and below the image. Is there a way to either
Set the Google Maps widget to obtain its height and width based off of the dimensions of the image being supplied or...
Obtain the aspect ratio of the image? If I can get that, then I can run a series of "#if" statements to set the widgets height & width.
Basically, I would like the map and image to have the same height when displayed on the page. The code for the template is below. Thanks in advance.
{{{!}}style="border: 1px solid darkgray;"
{{!}}-
{{!}}{{#widget:Google Maps
|height=270
|width=480
|lat={{{lat|}}}
|lng= {{{lng|}}}
|zoom={{{zoom|}}}
|}}
{{!}}|[[image:{{{image|}}}|none|480x270px]]}}
{{!}}-
{{!}}}

There is an extension for this (that I haven't tried myself): ImageSizeInfoFunctions. It will give you two parser functions for your purpose (and will work until the day one of your users try to put a file that a not a picture in there...)

Related

Zero-width borders for browser windows in XMonad

I'm new to XMonad. I'd like to have 1px borders for all windows (so I can tell which one is active), except for the browser. In a conventional window manager, I typically have one maximized web browser window in a designated workspace. I'm very used to bringing the mouse cursor all the way to the top edge of the screen to select browser tabs. But if I have 1px border around the browser window, if I slide the mouse all the way to the top it ends up over this border pixel and cannot select the tabs.
Is there a way to define different rules for specific windows regarding border width, or any other such properties?
Alternatively, is there a way to not have a border around any window, if it's the only one on the workspace?
Yes, all of it is possible.
Import xmonad-contrib's NoBorders Layout Extension using
import XMonad.Layout.NoBorders
Then, in your manageHook you can use hasBorder with conditions like checking the program's className (you may want to use XOrg's Property displayer xprop to find out your browser's actual className)
className =? "firefox" --> hasBorder False
Alternatively, you can launch your browser within a given layout and modify that layout in your layoutHook definition to not show borders at all using noBorders, or to remove them only in given one-window or fullsize-floating scenarios using smartBorders
noBorders Full ||| smartBorders Tall ||| ...

SSRS - Blank Pages (again...) even with respected settings

I know that the question was submitted a lot of times, but this is driving me mad.
I'm trying to make a landscape A4 report, printer friendly. As I could see in lots of threads before I tried to respect the fact that the body size must be inferior or equal to the physical page, including margins, and columns in the count.
Here are my document properties
Report:
Body:
I inserted a first rectangle with some contents, at that point, no extra blank page, here is the rectangle location :
Right after I inserted a second rectangle with same dimensions as previous one:
Both first pages are rendered correctly with the rectangle at its expected location, but I get a 3rd extra blank page...
ConsumeContainerWhiteSpace property is set to true, and this did not help...
Do you have any trick to get definitely rid of these blank pages ?
Thanks a lot !
EDIT : Just added the report designer view, as requested
Don't know how I didn't notice it before, but your body height is bigger than your page height defined in the report properties. If your report is supposed to generate two pages, that second page will have to add an extra 3 centimeters and cause that third page.
I finally managed to handle this the following way : I put my first rectangle 0,5cm under the header (with a forced pagebreak after) and if I use the same size of rectangle for everypage, ensuring that there's a 0,5 cm space between each rectangle, I can manage to display content on multiple pages, with rectangle bordel always located at the same position. Guess I should keep this method for all future reports :) Thanks a lot for your advices !

How to show a two color area?

Since now, in the design of one of the websites I work, I've been using a graphic to decorate the header section that consists in a diagonal division white in the lower side and transparent in the upper side. The result is this:
If I change upper color, as the image is transparent in its upper area the effect seems perfect:
Now, I need to allow users to change page background and that's the problem:
Background changes to red, but the image I used to decorate the header doesn't change.
Is there any way to allow users to change the background without ruin the header decoration?
Note that store a copies of the decoration imagen in different colors is not an option due I allow users to choose any 24-bit color. Also, to change the image in real time like explained here isn't an option due multiple users may access the same file.
You could try changing the image in realtime using data URIs: https://developer.mozilla.org/en/data_URIs
With a data URI, you can do something like the following: <img src="data:image/png;base64,SGVsbG8sIFdvcmxkIQ%3D%3D" />. The image can be changed dynamically in JS by generating a new image and setting the src attribute to the new data URI.
You will need to find a suitable format for generating images in JS though. I have used pnglib.js before, and it works, but it might be slower than you'd prefer. You might need to test some different libraries and image formats to see which can be generated quickly. Also, make the image as small as possible - should be only the area with the diagonal split, the area to the right can be done with a div instead.
Alternatively, you could generate a unique image server-side via a script. Make a script that takes a GET parameter for the background color and generates the appropriate image (for PHP, you can use GD or IMagick). Advantage is that the server may generate the image and send it to the client quicker than the client could generate it in JS.
Add the following to the div with the background image:
position: absolute;
top: 0px;
right: 0px;
The problem currently is that the background cannot overlap your div with the background image. Adding the position: absolute gives your div some kind of "ghost box" model, thus allowing the background of the body to overlap it.
P.S.: you can also play with z-index if you want to.

Generate rectangle with variable dimensions in CSS with inner gradient background

i have some variables on PHP who gain values from 0 to 100. I want to develop a simple graph system that draw a horizontal rectangle given the number (0, 1 , 50 and soo). Also i want to add some gradient to the background, doing this in php is complicated and i dont want more load in my server, so i know this is possible in css, but im not a css developer. So if any body can help me with this. In this page (http://www.answerbag.com/) you can se how i want the rectangle, in the results of the pool section in the middle of the above page.
that's very simple since you know the width. Since you probably want the full spectrum of the gradient to show, you probably want to resize the gradient image by using a css #score1 { width: 30px } on that <img id="score1" src="blue_gradient.png"> Then later on, you can use one of the many rounder corner methods to add the round corners to it.

How to create a custom GControl

I'm trying to create a gray "frame" (see pic below) around a google map, to try to convey the concept of an area of focus, as oppose to a point (which is usually represented with a marker). Note that this is not an overlay, that is, the gray "frame" should not move when you drag the map.
Edited: image link added
It appears that only option is to "subclass" GControl to create a custom control. I have 3 questions
1) First of all, is GControl subclassing the best course of action?
2) In my example, the canvas (div) where map renders can change its size (i.e is not fixed width). Do I have to delete and add custom control when canvas changes size? See docs http://code.google.com/apis/maps/documentation/controls.html#Custom_Controls on how to create a custom map control.
3) Now, how to do it. Naively, I thought I could create a table with 3 columns and 3 rows, and set display: none for the cell in the middle. But that doesn't work. I've also experimented with clipping, that didn't work either. My css skills are quite lacking, so there must be way to do this more elegantly than adding four rectangular gray divs. If I wanted to add an inner border, with divs, I would need to paint 8 then. In a nutshell, what's the best way to create a "hollow" rectangle?
Thanks
P.S. This is my first entry to StackOverflow. Just discovered it. It's impressive how well SO is put together.