From 67563d5c827ec929b1ab5bc9cffe6a9dea7902e2 Mon Sep 17 00:00:00 2001 From: Domovoy Date: Wed, 12 Sep 2012 11:55:09 +0200 Subject: [PATCH 1/5] Fallback to gd if Imagick can't load the data --- include/Photo.php | 104 +++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/include/Photo.php b/include/Photo.php index 5b6e6d846..8e4eb84bd 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -46,9 +46,52 @@ class Photo { } $this->type = $type; - if($this->is_imagick()) { - $this->image = new Imagick(); - $this->image->readImageBlob($data); + if($this->is_imagick() && $this->load_data($data)) { + return true; + } else { + // Failed to load with Imagick, fallback + $this->imagick = false; + } + return $this->load_data($data); + } + + public function __destruct() { + if($this->image) { + if($this->is_imagick()) { + $this->image->clear(); + $this->image->destroy(); + return; + } + imagedestroy($this->image); + } + } + + public function is_imagick() { + return $this->imagick; + } + + /** + * Maps Mime types to Imagick formats + */ + public function get_FormatsMap() { + $m = array( + 'image/jpeg' => 'JPG', + 'image/png' => 'PNG', + 'image/gif' => 'GIF' + ); + return $m; + } + + private function load_data($data) { + if($this->is_imagick()) { + $this->image = new Imagick(); + try { + $this->image->readImageBlob($data); + } + catch (Exception $e) { + // Imagick couldn't use the data + return false; + } /** * Setup the image to the format it will be saved to @@ -85,45 +128,28 @@ class Photo { $quality = JPEG_QUALITY; $this->image->setCompressionQuality($quality); } - } else { - $this->valid = false; - $this->image = @imagecreatefromstring($data); - if($this->image !== FALSE) { - $this->width = imagesx($this->image); - $this->height = imagesy($this->image); - $this->valid = true; - imagealphablending($this->image, false); - imagesavealpha($this->image, true); - } - } - } - public function __destruct() { - if($this->image) { - if($this->is_imagick()) { - $this->image->clear(); - $this->image->destroy(); - return; - } - imagedestroy($this->image); - } - } + $this->width = $this->image->getImageWidth(); + $this->height = $this->image->getImageHeight(); + $this->valid = true; - public function is_imagick() { - return $this->imagick; - } + return true; + } - /** - * Maps Mime types to Imagick formats - */ - public function get_FormatsMap() { - $m = array( - 'image/jpeg' => 'JPG', - 'image/png' => 'PNG', - 'image/gif' => 'GIF' - ); - return $m; - } + $this->valid = false; + $this->image = @imagecreatefromstring($data); + if($this->image !== FALSE) { + $this->width = imagesx($this->image); + $this->height = imagesy($this->image); + $this->valid = true; + imagealphablending($this->image, false); + imagesavealpha($this->image, true); + + return true; + } + + return false; + } public function is_valid() { if($this->is_imagick()) From 207451d82d8c56760630e4960e7cb4a9e160b841 Mon Sep 17 00:00:00 2001 From: pixelroot Date: Wed, 12 Sep 2012 14:42:10 +0200 Subject: [PATCH 2/5] modified: view/theme/smoothly/style.css --- view/theme/smoothly/style.css | 36 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index f856f66bb..f501877d2 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -3,7 +3,7 @@ Smoothly Created by Anne Walk and Devlon Duthie on 2011-09-24 - Modified by alex@friendica.pixelbits.de on 2012-09-11 + Modified by alex@friendica.pixelbits.de on 2012-09-12 ** Colors ** @@ -22,7 +22,7 @@ You can switch out the colors of the header, buttons and links by using a find a body { margin: 0 auto; padding-bottom: 3em; - position: relative; + /*position: relative;*/ width: 960px; font-family: "Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif; font-size: 15px; @@ -300,7 +300,7 @@ nav { height: 40px; position: fixed; color: #efefef; - background: url("nav-bg.png") no-repeat scroll 0px 0px transparent; + /*background: url("nav-bg.png") no-repeat scroll 0px 0px transparent;*/ /*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #7c7d7b), color-stop(1, #555753) );*/ /*background:-moz-linear-gradient( center top, #7c7d7b 5%, #555753 100% );*/ /*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c7d7b', endColorstr='#555753');*/ @@ -308,6 +308,14 @@ nav { margin-bottom: 16px; font-size: 15px; /*border-bottom: 1px solid #494948;*/ + + background: -moz-linear-gradient(center top , #BDBDBD 5%, #A2A2A2 100%) repeat scroll 0 0 #BDBDBD; + /*background-color: #f3f3f3;*/ + border: 1px solid #C5C5C5; /*1px solid #dddddd;*/ + -moz-box-shadow: 3px 3px 4px #959494; + -webkit-box-shadow: 3px 3px 4px #959494; + box-shadow: 0 0 8px #BDBDBD; /*3px 3px 4px #959494;*/ + border-radius: 5px 5px 5px 5px; } nav a { text-decoration: none; color: #eeeeec; border:0px;} nav a:hover { text-decoration: none; color: #eeeeec; border:0px;} @@ -467,11 +475,11 @@ ul#user-menu-popup li a.nav-sep { border-top: 1px solid #989898; border-style:in aside { float: right; - margin-right: 5px; /*10%*/ + /*margin-right: 5px;/ /*width: 21%;*/ - width: 200px; /*250*/ + width: 205px; /*250*/ margin-top: 40px; /*50*/ - font-size: 1.0em; + font-size: 0.9em; font-style: bold; } @@ -516,7 +524,7 @@ aside h4 { font-size: 1.3em; } color: #626262; text-align: center; font-weight: bold; - font-size: 1.1em; + font-size: 1em; } .allcontact-link a { padding-bottom: 10px; @@ -769,9 +777,12 @@ ul .sidebar-group-li .icon{ /* ================== */ .contact-block-img { - width: 48px; /*42*/ - height: 48px; - padding-right: 2px; + width: 47px; + height: 47px; + margin-right: 2px; + border: 1px solid #C5C5C5; + border-radius: 3px 3px 3px 3px; + box-shadow: 0 0 8px #BDBDBD; } .contact-block-div { float: left; @@ -1092,9 +1103,10 @@ profile-jot-banner-wrapper { .wall-item-location .icon { float: left; } .wall-item-location > a { margin-left: 0px; /*25*/ + margin-right: 2px; font-size: 0.9em; display: block; -/* font-variant:small-caps; */ + font-variant:small-caps; color: #898989; } @@ -3170,7 +3182,7 @@ a.active { background:-moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% ); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4'); background-color:#1873a2; - color:#efefef; + color:#fec01d; padding: 5px 10px 5px 10px; margin-right: 5px; } From a283d6844c10fe62c785536db96eacc71e4a70e2 Mon Sep 17 00:00:00 2001 From: pixelroot Date: Wed, 12 Sep 2012 14:44:42 +0200 Subject: [PATCH 3/5] modified: view/theme/smoothly/theme.php --- view/theme/smoothly/theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/theme/smoothly/theme.php b/view/theme/smoothly/theme.php index 70542a40f..f101fe564 100644 --- a/view/theme/smoothly/theme.php +++ b/view/theme/smoothly/theme.php @@ -3,7 +3,7 @@ /* * Name: Smoothly * Description: Theme optimized for iPad/iPad2 - * Version: 0.5 + * Version: 0.6 * Author: Alex * Maintainer: Alex * Screenshot: Screenshot From 77aee41280484d712bfcb73c89633a617c7977b0 Mon Sep 17 00:00:00 2001 From: pixelroot Date: Wed, 12 Sep 2012 15:49:18 +0200 Subject: [PATCH 4/5] modified: view/theme/smoothly/style.css --- view/theme/smoothly/style.css | 80 +++++++++++++++++------------------ 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/view/theme/smoothly/style.css b/view/theme/smoothly/style.css index f501877d2..a34cc0e18 100644 --- a/view/theme/smoothly/style.css +++ b/view/theme/smoothly/style.css @@ -176,34 +176,39 @@ section { } .button { - border: none; + border: 1px solid #7C7D7B; + box-shadow: 0 0 8px #BDBDBD; + -moz-box-shadow: 3px 3px 4px #959494; + -webkit-box-shadow: 3px 3px 4px #959494; + border-radius: 5px 5px 5px 5px; font-size: 1em; - -moz-box-shadow:inset 0px 1px 0px 0px #cfcfcf; - -webkit-box-shadow:inset 0px 1px 0px 0px #cfcfcf; - box-shadow:inset 0px 1px 0px 0px #cfcfcf; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #bdbdbd), color-stop(1, #a2a2a2) ); - background:-moz-linear-gradient( center top, #bdbdbd 5%, #a2a2a2 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#bdbdbd', endColorstr='#a2a2a2'); - background-color:#bdbdbd; - -moz-border-radius:5px; - -webkit-border-radius:5px; - border-radius:5px; - color:#efefef; - text-align: center; + box-shadow: inset 0px 0px 0px 0px #cfcfcf; + -moz-box-shadow:inset 0px 0px 0px 0px #cfcfcf; + -webkit-box-shadow:inset 0px 0px 0px 0px #cfcfcf; + background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #bdbdbd), color-stop(1, #a2a2a2) ); + background: -moz-linear-gradient( center top, #bdbdbd 5%, #a2a2a2 100% ); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bdbdbd', endColorstr='#a2a2a2'); + background-color: #bdbdbd; + color: #efefef; + text-align: center; } .button:hover { - border: none; - background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) ); - background:-moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% ); - filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4'); - background-color:#1873a2; - color: #efefef; + border: 1px solid #7C7D7B; + box-shadow: 0 0 8px #BDBDBD; + -moz-box-shadow: 3px 3px 4px #959494; + -webkit-box-shadow: 3px 3px 4px #959494; + border-radius: 5px 5px 5px 5px; + background: -webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1873a2), color-stop(1, #6da6c4) ); + background: -moz-linear-gradient( center top, #1873a2 5%, #6da6c4 100% ); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1873a2', endColorstr='#6da6c4'); + background-color: #1873a2; + color: #efefef; } .button:active { - position:relative; - top:1px; + position: relative; + top: 1px; } .button a { @@ -300,21 +305,13 @@ nav { height: 40px; position: fixed; color: #efefef; - /*background: url("nav-bg.png") no-repeat scroll 0px 0px transparent;*/ - /*background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #7c7d7b), color-stop(1, #555753) );*/ - /*background:-moz-linear-gradient( center top, #7c7d7b 5%, #555753 100% );*/ - /*filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c7d7b', endColorstr='#555753');*/ - /*background-color:#7c7d7b;*/ margin-bottom: 16px; font-size: 15px; - /*border-bottom: 1px solid #494948;*/ - background: -moz-linear-gradient(center top , #BDBDBD 5%, #A2A2A2 100%) repeat scroll 0 0 #BDBDBD; - /*background-color: #f3f3f3;*/ - border: 1px solid #C5C5C5; /*1px solid #dddddd;*/ - -moz-box-shadow: 3px 3px 4px #959494; - -webkit-box-shadow: 3px 3px 4px #959494; - box-shadow: 0 0 8px #BDBDBD; /*3px 3px 4px #959494;*/ + border: 1px solid #7C7D7B; + box-shadow: 0 0 8px #BDBDBD; + -moz-box-shadow: 3px 3px 4px #959494; + -webkit-box-shadow: 3px 3px 4px #959494; border-radius: 5px 5px 5px 5px; } nav a { text-decoration: none; color: #eeeeec; border:0px;} @@ -334,9 +331,9 @@ nav #banner #logo-text a { } nav #user-menu { display: block; - width: 190px; /*240*/ + width: 190px; float: right; - margin-right: 5px; /*20%*/ + margin-right: 5px; margin-top: 3px; padding: 5px; position: relative; @@ -348,7 +345,7 @@ nav #user-menu { -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; - border: 1px solid #9A9A9A; + border: 1px solid #7C7D8B; color:#efefef; text-decoration:none; text-align: center; @@ -1788,12 +1785,13 @@ margin-left: 0px; .mail-list-sender { float: left; - padding: 5px; + padding: 2px; background-color: #efefef; - border: 1px dotted #eeeeee; - -moz-box-shadow: 3px 3px 4px #959494; - -webkit-box-shadow: 3px 3px 4px #959494; - box-shadow: 3px 3px 4px #959494; + border: 1px solid #C5C5C5; + border-radius: 3px 3px 3px 3px; + box-shadow: 0 0 8px #BDBDBD; + -moz-box-shadow: 3px 3px 4px #959494; + -webkit-box-shadow: 3px 3px 4px #959494; } .mail-list-detail { From ae0b830b7c5b0aee40d0a46367d5da6c47b7a2b2 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Wed, 12 Sep 2012 22:12:08 +0100 Subject: [PATCH 5/5] Couple of spare smiley images removed. Should have been deleted when these got moved to smiley_pack --- images/smiley-beard.png | Bin 1094 -> 0 bytes images/smiley-whitebeard.png | Bin 1060 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 images/smiley-beard.png delete mode 100644 images/smiley-whitebeard.png diff --git a/images/smiley-beard.png b/images/smiley-beard.png deleted file mode 100644 index 5d4b28463f6d1b09991299734da0a0fdbbf285ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1094 zcmV-M1iAZ(P)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX0|pj23M2yA-v9srLUct~bVF}# zZDnqB07FtmK~zstIv{6cEoyLOXCQVlE-)Y{b#rNMXCO&RM<7a2MMofZHZmzJAaQkJ zY-x0PAUz;4Ffa4?JXdVOr zL{)(l@JJmX;K{#~Zl6_~&JxEBB$K5p>Y-RXAW?CQBq<;n@Js^;0r2RUb#1?~`X|3# zJE^0?e-VXCs10x^7G-IvPiJOtuz&b1aSGt>(h=1fs@qUtqx==6*$;K_!F6y;WW5&F zZXrfV-F8%VvtH?DwY-;o!>@{Ekc?3b0;*NwL{Y8r>(o(AHqd6dTTj1%e*96Sapj;^ zmPhpIC(%pa9MHyEzg8B|@}0M}9xG1UFphwXf%5Y2^cEX<0?oLapRT}#FRK_Y$KvuD zzg&est}oz=As@n0=~{a(s-TL8`eaPZ^pBtG%EBUH7_fh2fD^BD)3>XFv41nL*D?Mc z96L6Gb%wL&=DG6oMP7XA2Zlxup=uDDq>|!V zs(sAOhD=OMQ7ZXZ*NvD!PK}>uaPU#QwUyhPKl=%Zb%+*;w(Vw5e>b0tz673+I1A)RDU!NEyHm{q5!Qx`jvfJ%C2a|ULjX@yDfILKyFgR&(RS9$ zG0oVptM4K1tSo`868I3e9ET2%@!IJRB|@O@})1(Oo5kAydzF`aNh$v5NUy$wrW)^s){;AZHwbPx#32;bRa{vGf6951U69E94oEQKA00(qQO+^RX0|pj40fFXX)c^nhLUct~bVF}# zZDnqB07FtmK~zstIv{6cEoyLOXCQVlE-)Y{b#rNMXCO&RM<7a2MMofZHZmzJAaQkJ zY-x0PAUz;4Ffag_u6|INeD1xzz~SZLzNH!3)TW2d;kfG4vgCX3ZOa|05Fn(Y)aq( z1CedhZhkHAZ<9_YSXZE2U7)_}xT)6PAtX+&0Ejw`n69Lg2=p(CNsRp1dTy+03@5=>;B!(dG48n5H^^LbG+{X z5HycCKr*P&-8{&P$38MSM{q_MV?Y{_ra~HU^|zDCdnoNz^~o~&@{6iQ{nwQ|JfXKw zp2vMMC7wRm<>-+ixdLa;4mkD3X)2|NsIWk( z_CCF>H+ka8f{`p{dwZK!^O_DH-j9oG$a@G)?zg_7Ub#%6utu;M!S7`>K1!iPRG?HWW5_XNL@w~bnfF*-S>d~H&(msdaO3(K%O8J6kmZ#V$AAe^#%P=ZF<>!1 z%jqQ@mCFU@D!T|cEFPH9`uirAuil{E*v-k;UZqs4fntJ*84mgsBT+2R8wk^@ZS^{G zkx0Fx(O5zVOFFX->=+6=n;>F5*`g4Ga}@&+K_K8*?{p{@W2)6E)|SXA;wbL$1i%RL zET!9Rk>@Fk3;S@TnY%*>v!}`!jk=mldXl^pq#M_7Y0w{OJjoR#1xf9DO)1}EkUUhs z*PVGy7zNEH4-AJR#gV1I*}>;S_UxTE-Ckd%N|hu@a5iT5;(jw%Y=G=++v(aS$YYom zgWu*+=Yh(#Dz(~z$*~x~5qLc8E6pa%&o3FtAp-{OU}qMYg*;O=Ktx~+(*J+}X4*Z> e#J4*~fd2qjcOya))CaTx0000