From a3e1f8bf328199b15abad680e0f7abbf284d8cd1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 28 Aug 2009 16:34:10 -0400 Subject: dal images, where rmagick cannot be loaded use imagemagick directly if available --- CHANGELOG | 9 +++++++++ conf/sisu/version1.yml | 6 +++--- lib/sisu/v1/dal_images.rb | 15 +++++++++++---- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 79e78304..82c5ba59 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,15 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.71.3.orig.tar.gz (2009-08-28:34/5) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.71.3.orig.tar.gz + sisu_0.71.3.orig.tar.gz + sisu_0.71.3-1.dsc + sisu_0.71.3-1.diff.gz + + * fix to use imagemagick directly (when imagemagick is available and rmagick + declares versions not in sync) + %% sisu_0.71.2.orig.tar.gz (2009-08-02:30/7) http://www.jus.uio.no/sisu/pkg/src/sisu_0.71.2.orig.tar.gz 220199cbc435ec6d246af4ac43a2ef6a3e05f649847c4ee04b831af1e8ad4902 1548875 sisu_0.71.2.orig.tar.gz diff --git a/conf/sisu/version1.yml b/conf/sisu/version1.yml index 63106385..b0cb9aee 100644 --- a/conf/sisu/version1.yml +++ b/conf/sisu/version1.yml @@ -1,5 +1,5 @@ --- -:version: 0.71.2 -:date_stamp: 2009w30/7 -:date: "2009-08-02" +:version: 0.71.3 +:date_stamp: 2009w34/5 +:date: "2009-08-28" :project: SiSU diff --git a/lib/sisu/v1/dal_images.rb b/lib/sisu/v1/dal_images.rb index 67893025..1882aea5 100644 --- a/lib/sisu/v1/dal_images.rb +++ b/lib/sisu/v1/dal_images.rb @@ -67,7 +67,11 @@ module SiSU_images @rmgk=false imagemagick_=SiSU_Env::Info_settings.new.program?('rmagick') if imagemagick_ - @rmgk=SiSU_Env::Load.new('RMagick').prog + begin + @rmgk=SiSU_Env::Load.new('RMagick').prog + rescue + @rmgk=false + end else if @md.cmd =~/[vVM]/ tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml') @@ -81,6 +85,7 @@ module SiSU_images m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ if imagemagick_ imgs=para.scan(m).flatten + img_col=img_row=nil images=imgs.each do |image| dir=SiSU_Env::Info_env.new(@md.fns) path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex] @@ -101,19 +106,21 @@ module SiSU_images img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2] img_col,img_row=img_col.to_i,img_row.to_i end + row=(img && defined? img.rows) ? img.rows : img_row + col=(img && defined? img.columns) ? img.columns : img_col if img_col > img_row #landscape if img_col> 640 #480 img_col=640 #480 - img_row=((1.00*img_col/img.columns)*img.rows).round + img_row=((1.00*img_col/col)*row).round end else #portrait if img_col> 640 #480 img_col=640 #480 - img_row=((1.00*img_col/img.columns)*img.rows).round + img_row=((1.00*img_col/col)*row).round end if img_row > 640 img_row=640 - img_col=((1.00*img_row/img.rows)*img.columns).round + img_col=((1.00*img_row/row)*col).round end end para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") -- cgit v1.2.3