Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13978530
D12809.id30787.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D12809.id30787.diff
View Options
diff --git a/resources/builtin/image-100x100.png b/resources/builtin/image-100x100.png
new file mode 100644
index 0000000000000000000000000000000000000000..c56a9aa0835ccbe7ab631b372d07a2b406d33872
GIT binary patch
literal 993
zc%17D@N?(olHy`uVBq!ia0vp^DIm<j1SJ1AFfjuu$r9IylHmNblJdl&R0hYC{G?O`
z&)mfH)S%SFl*+=BsWuD@%*~!Ijv*Dd-pum%mvWRi#wu=dEaT8E7NM;Zz9c-jQ}yA_
zGIhQ>zW1*#POj@;_H{wbPqwyZUxwrsH8~R|PQhM9MnTbEQ?}2|>G{JsVeYQqHk^}Z
z-Yjo_qkn#n@#Y7ffB%>|@~Sb<=YLqvaxwh5`1QCTiI^7G2nZ5M6cmFXm`IB&Oe8T7
zRaxfr#OKp(?d<;j__sE0y}iACzum1TPf{#o{{4BnI#GhJh1F+kRBm;3b<Bpc@^b0k
zV{hK9QJ#A>XKR$*{Ph7E6?^0Qj~m~ycv~j@*hNWj3O_$ztLk~pWfoReRa2+4d=Zma
zyLPST2ZfLMqSx-HE?vBI>C!OwPX`#(|JLU3-?d9h<&5P9k-0%DORB58(-Z_EVq!wV
zcYB^$!8$EmS%>4~>ZrAT<t<z~$y+1L4|cw5YGr4e;<dEtk19vN&Ye47dV3k{<d`<g
zYtq8dXF{hVrk+ikeDVo*Qx=Q3uXB!?@8u(Yp$Q9{mKjM+Iho?;=QrWvfzwOR3H@Hc
zvS#YksXzmw+*d5<^n2L)>Bo;7FIL3pCAaN65m}Ze^<{nAfySF6y>5xxFTX^TR8@5`
z%$%K}^qsxgaqsGd3k}mbbzUcX+n;h#Dy*#RR1K2t30fJlF(M{DKHTtK6z^4~6-%m$
zcFwus^|bDSrM2~BiP&g%=kB#t{;DxYe{Q^))Ac*xP<+Os;Jb_13SFDT1+Hy9zv}GS
zv#qVHDSzF-ZekFs$@Bb>#I^svzUAwyGiJ`5+1tw-bNALQr{etl^?&^jv{Y}k@V=e3
zWB>m7=b!K1=`3U~w8w;>kMDv0)IFD8me|OZUv!Le_%g%yMSWG(q*zuhA+?V?uE*xf
zCJ5x*tZr`%)Dd%j`tM)dipbjMVi8Gms`lP9fA7(7wbpF^hu`{UOHVjX^-Aqf;SJgm
zetKER`Rvpw?d|Q0_cTxU$=`f*i?4GwpVY4dPYTi_@2B+I^_@NOrcL$t`$F60QfFsw
z*x-8W=FPzUFM1y7+_-GwYkf9VTW9|H{~s^Ex_kF-gwW<hiN*#?Q`5IT5f&eH_4o6)
zIz9HPS6JHTa;|t<eqCMNqqAN0mP$H@z^H2jM>hn)L=G*2iEPj~graQA>+|;i&*`t@
fOcMAjmcWn`HTC|gto!SMd6vP`)z4*}Q$iB}an!@D
literal 0
Hc$@<O00001
diff --git a/resources/builtin/image-220x220.png b/resources/builtin/image-220x220.png
new file mode 100644
index 0000000000000000000000000000000000000000..928b5b05eb16f1d0d6565191ab41342d6d8fd3ce
GIT binary patch
literal 1322
zc%17D@N?(olHy`uVBq!ia0vp^cR-kf2}n+{h`0u%BuiW)N`mv#O3D+9QW+dm@{>{(
zJaZG%Q-e|yQz{EjrrIztu$=L9aSW-r_2#y<cS^d%fsdi-F@k{wJQ^?D6k9Xq<|NLY
zaO%+c#P!p{e%U%DE!<YeywTtRYb0;Z#z(9v?t%wTTg82P;LUe<Q(T!1Tlal_nP)QR
zeF}ekp7Z%!#@$Qz|L<wMzC^&@{_DR7E+4#V{(RYaFY>`wLDfYpfl6KiFsef+ut`G@
zLAi8lI8K353SKUpi(C+t0Fqu5O+X5+2}q%60#c+}IH9{K_`?RTrJt_Pub(q_ZftzK
z{r|gCQc_jb)%Abhes?-JQ#^I8((%ieFL!o!?pZWv)~sDSc4TB`7UsD|eqOR?&(58i
zV%@uU@BaGrYiVie*1hN7z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b/resources/builtin/image-280x210.png
new file mode 100644
index 0000000000000000000000000000000000000000..48237b045e722ee3ca84586aeb70139f3be57741
GIT binary patch
literal 1349
zc%17D@N?(olHy`uVBq!ia0y~yV3Yu|FL5vdNx2sudx4Z>iEBhjaDG}zd16s2gJVj5
zQmTSyZen_BP-<dIW#P$G8wLiJ=bkQ(Ar-gY-0}8~NtZZKsBfGm5LggouwbQ=_@dWl
z-D{$E6+L`@A})5<rT2kR;;*jdE9mJ|I9_oQ6Vz7-6imEg5%=rG?0G(_Spf$h{Hc3j
z@Vp{T%>AFu^F4jn&i(o8&-=k(=Z{}2KeMYdy?gt&y}$Gvlg*q74ju|B0zx3n!P&wB
z!cI(zj6mE7lxn~#4OY@PfdQ;UK?S0OgA<|zhcrnRC|a^&G4f#Xv|_G#UOQv{y*_Wx
z$IpNM+&Q^_d0)SNojZ5#{(s-9^`56|Ey)t%oa(i7;lhQ-xiV8yp8WW+W97<|J4J&+
zeV0uB{P}Z@-TsXm1H;3^qob?$f8V)dN5}V<uU>T>_n+UQvgDO8?~+6#Tid@^r(I&)
z-d%TZU+rwZf72cdUiutTzI5^8$A7%K6c>5@eqZzR*RNmOW!fgptM`bsj0T!jUA^(<
zty{P5-J4hYT`jYN^X1F>4!?utLO~s~mo_&yADUVrw0K#O$z2t-853Gue7h8zZr;4v
z`FrUUcbl7c@9y2aXv%~MEk~xG-n=Dh!d=a!fx(%HiHTWRucBgaS}UkbFEia4vo1ns
z+UchvK{lOda~xWK{``6L=+Pa`UDJG26hGQ$zB!WIa^>#byLaxy>=N=%GA>&-?NMP_
znOS*ib+z@nU+eBFNB*db3VXY6dZ)<BBcf6M{{B6Sw`|^a=+dPinF;H@Cl%M$?p?cf
z?XgvJC+sNepW?L2N9k?<@slS{Zr!@oY2k$085wD5X~o5x_wTp2K9*UMnXYs-^)=U5
z(M`76+S-{isjmeB&wct-WOeM*_D&byT}8W}e$v@D`}}i%Kfg;?x{lBA-Y99kd3s8I
zQ)kH4ZeGnvr%ZQwF*7sk$M4gb>UBK)k!Q}aa~<kSQ#T%TF`B4nYGSgaddYgZ%QtTP
zcz1XAk9Q9qB;@q<^~L>B7wWn`%fsnW(Y&7C-nHx2-7^Wjq~x+Nz+?8~$BzxCZ<@Vy
z=gyt`_Sr2D^l<tmb5b`vW8?oXUrg5a9G_egVPzMWz0uL5=HJx7oiY3VZg{bL`*!nr
zGP1Hu7im48dRaq7kNw=khY#m|w|v=fYUR`ZpTIb=c{DFQJ^i^HH(Oxfo@-vs6IRs<
zEIr=Y+1dW*eA|{+2_~E?Z-w6bd?$aIWxLa=SKYg29sg0f%Kr}M%2i9xtJ;Jy-`uUZ
z<W-P{NLzdR=KnHZCUlA<uZ_@=@^V^b^|R*i`Tcut-oIZz#kDC$@A|E%nvaVf9N}8I
z%f!rVU)|rwtHamJy)M(%I%Vh9GGSG^($naus5$M=54w8~seIeL{=2-LmEZ?~|6B$P
ZNzK!CyKR_e4lEZLJYD@<);T3K0RTT*Lz(~p
literal 0
Hc$@<O00001
diff --git a/src/applications/files/controller/PhabricatorFileTransformController.php b/src/applications/files/controller/PhabricatorFileTransformController.php
--- a/src/applications/files/controller/PhabricatorFileTransformController.php
+++ b/src/applications/files/controller/PhabricatorFileTransformController.php
@@ -54,7 +54,18 @@
if (isset($xforms[$transform])) {
$xform = $xforms[$transform];
if ($xform->canApplyTransform($file)) {
- $xformed_file = $xforms[$transform]->applyTransform($file);
+ try {
+ $xformed_file = $xforms[$transform]->applyTransform($file);
+ } catch (Exception $ex) {
+ // TODO: Provide a diagnostic mode to surface these to the viewer.
+
+ // In normal transform mode, we ignore failures and generate a
+ // default transform instead.
+ }
+ }
+
+ if (!$xformed_file) {
+ $xformed_file = $xform->getDefaultTransform($file);
}
}
diff --git a/src/applications/files/transform/PhabricatorFileThumbnailTransform.php b/src/applications/files/transform/PhabricatorFileThumbnailTransform.php
--- a/src/applications/files/transform/PhabricatorFileThumbnailTransform.php
+++ b/src/applications/files/transform/PhabricatorFileThumbnailTransform.php
@@ -71,4 +71,20 @@
}
}
+ public function getDefaultTransform(PhabricatorFile $file) {
+ $x = (int)$this->dstX;
+ $y = (int)$this->dstY;
+ $name = 'image-'.$x.'x'.nonempty($y, $x).'.png';
+
+ $params = array(
+ 'name' => $name,
+ 'canCDN' => true,
+ );
+
+ $root = dirname(phutil_get_library_root('phabricator'));
+ $data = Filesystem::readFile($root.'/resources/builtin/'.$name);
+
+ return PhabricatorFile::newFromFileData($data, $params);
+ }
+
}
diff --git a/src/applications/files/transform/PhabricatorFileTransform.php b/src/applications/files/transform/PhabricatorFileTransform.php
--- a/src/applications/files/transform/PhabricatorFileTransform.php
+++ b/src/applications/files/transform/PhabricatorFileTransform.php
@@ -7,6 +7,10 @@
abstract public function canApplyTransform(PhabricatorFile $file);
abstract public function applyTransform(PhabricatorFile $file);
+ public function getDefaultTransform(PhabricatorFile $file) {
+ return null;
+ }
+
public function generateTransforms() {
return array($this);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 19, 11:39 PM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734312
Default Alt Text
D12809.id30787.diff (7 KB)
Attached To
Mode
D12809: Make modular transforms handle exceptions gracefully
Attached
Detach File
Event Timeline
Log In to Comment