Modulo:Immagine multipla: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
fix |
Recupero delle dimensioni dal file nel caso di richiesta di altezze omogenee, fix box che racchiude la galleria per una lista verticale |
||
Riga 65:
end
return prownum
--=====================================================
-- Ritorna le dimensioni dell'immagine (larghezza x altezza)
-- Se queste non sono passate dai parametri tenta di recuperarle
-- dalle informazioni del file immagine, altrimenti ricade su
-- una larghezza pari a 200 e un'altezza pari alla larghezza
--=====================================================
local function get_dimensions(w, h, name)
local hr = h and tonumber(h)
local page = mw.title.new(name, 'Media')
if not wr then
wr = page.file and page.file.width
end
if not hr then
hr = page.file and page.file.height
end
end
wr = wr or 200
hr = hr or wr
return wr, hr
end
Line 139 ⟶ 163:
local widthmax = 0
local widthsum = {}
local heights = {}▼
local k = 0
for r=1,rowcount do
Line 146 ⟶ 171:
if k <= imagecount then
local w = args['larghezza' .. imagenumbers[k]]
if totalwidth > 0 then
▲ widths[k] = (w and tonumber(w)) or width
widths[k], heights[k] = get_dimensions(w, h, args['immagine' .. imagenumbers[k]])
else
widths[k] = (w and tonumber(w)) or width
end
widthsum[r] = widthsum[r] + widths[k]
end
Line 154 ⟶ 184:
-- if total_width has been specified, rescale the image widths
▲ local heights = {}
if totalwidth > 0 then
widthmax = 0
Line 166 ⟶ 195:
k = k + 1
if k<= imagecount then
▲ local h = tonumber( args['altezza' .. i] or '' ) or 0
▲ if (h > 0) then
▲ ar[j] = widths[k]/h
else
ar[j] = widths[k]/100
Line 260 ⟶ 286:
end
end
--
▲ :css('clear', 'left')
▲ end
end
-- add the footer
Line 273 ⟶ 296:
:css('text-align', args['allinea sotto'] or 'left')
:css('background-color', args['sfondo sotto'] or 'transparent')
end
return tostring(root)
|