diff s4-funcs.sh @ 146:3d0de7bdbf40

Profile image
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 30 Nov 2015 09:02:38 +0859
parents f9e8504bb8f2
children b3d8a389e7a8
line wrap: on
line diff
--- a/s4-funcs.sh	Thu Nov 05 21:59:46 2015 +0859
+++ b/s4-funcs.sh	Mon Nov 30 09:02:38 2015 +0859
@@ -1360,10 +1360,22 @@
   tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$
   echo "$gecos さん" > $tf
   viewtable $formdir/user.def user $1	> $pf
+
+  sqcond="WHERE name='$user' AND key='profimg' AND type LIKE 'file:image%'"
+  img=`query "SELECT type FROM user_m $sqcond LIMIT 1;"`
+  imf=tmp/profimg; touch $imf
+  if [ -n "$img" ]; then
+    { printf '%s' "<img width=\"400\" src=\"data:${img#file:},"
+      query "SELECT hex(bin) FROM user_m $sqcond LIMIT 1;" \
+	  | sed 's/\(..\)/%\1/g'
+      echo '"'
+    } > $imf
+  fi
   listblog $uname			> $bf
   listgroupbytable $formdir/grp.def $cond \
       | m4 -D_BODYCLASS_=home -D_TITLE_="spaste(\`$tf')" \
 	   -D_PROFILE_="spaste(\`$pf')$conflink" \
+	   -D_PROFIMG_="spaste(\`$imf')" \
 	   -D_BLOGS_="spaste(\`$bf')" \
 	   -D_GROUPS_="syscmd(\`cat')" \
 	   $layout/html.m4.html $layout/home.m4.html

yatex.org