From bd6a5fe3b1ad4c41568bd665bdb0ecfa7c7a5f02 Mon Sep 17 00:00:00 2001 From: Vincent Zanotti Date: Thu, 29 May 2008 21:00:56 +0200 Subject: [PATCH] Uses properly resized thumbnails for medals in user's profile. Signed-off-by: Vincent Zanotti --- Makefile | 11 ++++++++++- htdocs/images/medals/thumb/.gitignore | 1 + modules/profile.php | 7 ++++++- templates/profile/deco.medal.tpl | 2 +- templates/profile/profile.tpl | 2 +- 5 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 htdocs/images/medals/thumb/.gitignore diff --git a/Makefile b/Makefile index 7b62aeb..0b6b37b 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ endef all: build -build: core banana wiki jquery +build: core banana wiki medals jquery q: @echo -e "Code statistics\n" @@ -114,7 +114,16 @@ htdocs/css/banana.css: include/banana/banana.inc.php: cd $(@D) && find $(BANANA)/banana/ -name '*.php' -exec ln -snf {} . ";" +## +## Medal thumbnails +## +MEDAL_PICTURES=$(wildcard htdocs/images/medals/*.jpg) +MEDAL_THUMBNAILS=$(subst /medals/,/medals/thumb/,$(MEDAL_PICTURES)) + +medals: $(MEDAL_THUMBNAILS) +$(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F)) + convert -resize x50 $(subst /medals/thumb/,/medals/,$@) $@ ## ## jquery diff --git a/htdocs/images/medals/thumb/.gitignore b/htdocs/images/medals/thumb/.gitignore new file mode 100644 index 0000000..66b83c1 --- /dev/null +++ b/htdocs/images/medals/thumb/.gitignore @@ -0,0 +1 @@ +/*.jpg diff --git a/modules/profile.php b/modules/profile.php index bde1cf2..c72a9c0 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -105,11 +105,16 @@ class ProfileModule extends PLModule function handler_medal(&$page, $mid) { + $thumb = ($mid == 'thumb'); + $mid = $thumb ? @func_get_arg(2) : $mid; + $res = XDB::query("SELECT img FROM profile_medals WHERE id = {?}", $mid); - $img = dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell(); + $img = $thumb ? + dirname(__FILE__).'/../htdocs/images/medals/thumb/' . $res->fetchOneCell() : + dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell(); $type = mime_content_type($img); header("Content-Type: $type"); echo file_get_contents($img); diff --git a/templates/profile/deco.medal.tpl b/templates/profile/deco.medal.tpl index 6cf8339..4e76dcf 100644 --- a/templates/profile/deco.medal.tpl +++ b/templates/profile/deco.medal.tpl @@ -22,7 +22,7 @@
- +
diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index 68ce962..e6a51d2 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -172,7 +172,7 @@ function chgMainWinLoc(strPage)

Distinctions :

{foreach from=$x.medals item=m}
- {$m.medal} + {$m.medal}
{$m.medal}
{$m.grade}
-- 2.1.4