Explorar el Código

blog image is a standard size

Bob Mottram hace 9 años
padre
commit
10c2e13c61
Se han modificado 2 ficheros con 20 adiciones y 1 borrados
  1. 3
    0
      src/freedombone
  2. 17
    1
      src/freedombone-blog

+ 3
- 0
src/freedombone Ver fichero

@@ -7750,6 +7750,9 @@ function install_blog {
7750 7750
         return
7751 7751
     fi
7752 7752
 
7753
+    # for the avatar changing command
7754
+    apt-get -y install imagemagick
7755
+
7753 7756
     if [ ! -d /var/www/$FULLBLOG_DOMAIN_NAME ]; then
7754 7757
         mkdir /var/www/$FULLBLOG_DOMAIN_NAME
7755 7758
     fi

+ 17
- 1
src/freedombone-blog Ver fichero

@@ -120,7 +120,23 @@ function set_avatar_from_url {
120 120
 
121 121
     # download the image
122 122
     cd $BASE_DIR/customimages
123
-    wget $AVATAR -O avatar.png
123
+    # convert to png
124
+    wget $AVATAR -O avatar
125
+    if [[ $AVATAR == *".gif" ]]; then
126
+        mogrify -format png avatar
127
+    fi
128
+    if [[ $AVATAR == *".jpg" ]]; then
129
+        mogrify -format png avatar
130
+    fi
131
+    if [[ $AVATAR == *".jpeg" ]]; then
132
+        mogrify -format png avatar
133
+    fi  
134
+    if [[ $AVATAR != *".png" ]]; then
135
+        mv avatar avatar.png
136
+    fi
137
+    
138
+    # standard size
139
+    mogrify -resize 150x150 avatar.png
124 140
     if [ ! -f $BASE_DIR/customimages/avatar.png ]; then
125 141
         echo $'Avatar image could not be downloaded'
126 142
         exit 3