public function gentom()
 {
     $sw = '{"d7c8b5":{"file":"01-d7c8b5.png","id":1},"d2b9a0":{"file":"02-d2b9a0.png","id":2},"cbb79c":{"file":"03-cbb79c.png","id":3},"b8a28c":{"file":"04-b8a28c.png","id":4},"ddbf9e":{"file":"05-ddbf9e.png","id":5},"d1b293":{"file":"06-d1b293.png","id":6},"cfa690":{"file":"07-cfa690.png","id":7},"dab084":{"file":"08-dab084.png","id":8},"b69b76":{"file":"09-b69b76.png","id":9},"6b5b4b":{"file":"10-6b5b4b.png","id":10},"501d24":{"file":"11-501d24.png","id":11},"4d1b22":{"file":"12-4d1b22.png","id":12},"3f2022":{"file":"13-3f2022.png","id":13},"431e22":{"file":"14-431e22.png","id":14},"622430":{"file":"15-622430.png","id":15},"621b24":{"file":"16-621b24.png","id":16},"7e1f33":{"file":"17-7e1f33.png","id":17},"99232d":{"file":"18-99232d.png","id":18},"be3849":{"file":"19-be3849.png","id":19},"a62d46":{"file":"20-a62d46.png","id":20},"e3cfb7":{"file":"21-e3cfb7.png","id":21},"d0b79e":{"file":"22-d0b79e.png","id":22},"dbb086":{"file":"23-dbb086.png","id":23},"dbb89c":{"file":"24-dbb89c.png","id":24},"c39b78":{"file":"25-c39b78.png","id":25},"d4b194":{"file":"26-d4b194.png","id":26},"c3976d":{"file":"27-c3976d.png","id":27},"b6906b":{"file":"28-b6906b.png","id":28},"73533c":{"file":"29-73533c.png","id":29},"604742":{"file":"30-604742.png","id":30},"542126":{"file":"31-542126.png","id":31},"4e2426":{"file":"32-4e2426.png","id":32},"441e26":{"file":"33-441e26.png","id":33},"471a1e":{"file":"34-471a1e.png","id":34},"731727":{"file":"35-731727.png","id":35},"a7282d":{"file":"36-a7282d.png","id":36},"a12227":{"file":"37-a12227.png","id":37},"a33145":{"file":"38-a33145.png","id":38},"cf6672":{"file":"39-cf6672.png","id":39},"a03856":{"file":"40-a03856.png","id":40},"d0b99b":{"file":"41-d0b99b.png","id":41},"e2ba94":{"file":"42-e2ba94.png","id":42},"d2ae8f":{"file":"43-d2ae8f.png","id":43},"d5a47a":{"file":"44-d5a47a.png","id":44},"d4a47c":{"file":"45-d4a47c.png","id":45},"bb9973":{"file":"46-bb9973.png","id":46},"b29273":{"file":"47-b29273.png","id":47},"906d53":{"file":"48-906d53.png","id":48},"ae7549":{"file":"49-ae7549.png","id":49},"a57a50":{"file":"50-a57a50.png","id":50},"441c21":{"file":"51-441c21.png","id":51},"3f171c":{"file":"52-3f171c.png","id":52},"5a2730":{"file":"53-5a2730.png","id":53},"861b29":{"file":"54-861b29.png","id":54},"cc4046":{"file":"55-cc4046.png","id":55},"d83f45":{"file":"56-d83f45.png","id":56},"ce2e33":{"file":"57-ce2e33.png","id":57},"f59185":{"file":"58-f59185.png","id":58},"d84c60":{"file":"59-d84c60.png","id":59},"262724":{"file":"60-262724.png","id":60},"dcb585":{"file":"61-dcb585.png","id":61},"b7946e":{"file":"62-b7946e.png","id":62},"daa989":{"file":"63-daa989.png","id":63},"d8a47c":{"file":"64-d8a47c.png","id":64},"bd9b80":{"file":"65-bd9b80.png","id":65},"a77d5d":{"file":"66-a77d5d.png","id":66},"7c5946":{"file":"67-7c5946.png","id":67},"c5985b":{"file":"68-c5985b.png","id":68},"845a44":{"file":"69-845a44.png","id":69},"a7764c":{"file":"145-a7764c.png","id":145},"482327":{"file":"71-482327.png","id":71},"823133":{"file":"72-823133.png","id":72},"791b27":{"file":"73-791b27.png","id":73},"891d2f":{"file":"74-891d2f.png","id":74},"91413d":{"file":"75-91413d.png","id":75},"b01f2c":{"file":"76-b01f2c.png","id":76},"df5d5b":{"file":"77-df5d5b.png","id":77},"e76269":{"file":"78-e76269.png","id":78},"2c2c2e":{"file":"79-2c2c2e.png","id":79},"232c39":{"file":"80-232c39.png","id":80},"be9b77":{"file":"81-be9b77.png","id":81},"b79372":{"file":"82-b79372.png","id":82},"b78b63":{"file":"83-b78b63.png","id":83},"c8a17b":{"file":"84-c8a17b.png","id":84},"c09469":{"file":"85-c09469.png","id":85},"8d6c4f":{"file":"86-8d6c4f.png","id":86},"bf9e59":{"file":"87-bf9e59.png","id":87},"9c6a48":{"file":"88-9c6a48.png","id":88},"9a7251":{"file":"89-9a7251.png","id":89},"956846":{"file":"90-956846.png","id":90},"692328":{"file":"91-692328.png","id":91},"751c27":{"file":"92-751c27.png","id":92},"a32734":{"file":"93-a32734.png","id":93},"a2373e":{"file":"94-a2373e.png","id":94},"c14840":{"file":"95-c14840.png","id":95},"d16068":{"file":"96-d16068.png","id":96},"c67463":{"file":"97-c67463.png","id":97},"2b2728":{"file":"98-2b2728.png","id":98},"222a3f":{"file":"99-222a3f.png","id":99},"1d2f3f":{"file":"100-1d2f3f.png","id":100},"ae8a6f":{"file":"101-ae8a6f.png","id":101},"b78a69":{"file":"102-b78a69.png","id":102},"b69468":{"file":"103-b69468.png","id":103},"ba9b81":{"file":"104-ba9b81.png","id":104},"8c6f57":{"file":"105-8c6f57.png","id":105},"bf9564":{"file":"106-bf9564.png","id":106},"ab793d":{"file":"107-ab793d.png","id":107},"af7a51":{"file":"108-af7a51.png","id":108},"7e553c":{"file":"109-7e553c.png","id":109},"986646":{"file":"110-986646.png","id":110},"811d2c":{"file":"111-811d2c.png","id":111},"782b2e":{"file":"112-782b2e.png","id":112},"743030":{"file":"113-743030.png","id":113},"c46b66":{"file":"114-c46b66.png","id":114},"e95c67":{"file":"115-e95c67.png","id":115},"e88188":{"file":"116-e88188.png","id":116},"262728":{"file":"117-262728.png","id":117},"1f2332":{"file":"118-1f2332.png","id":118},"222d46":{"file":"119-222d46.png","id":119},"2c3b47":{"file":"120-2c3b47.png","id":120},"ac805e":{"file":"121-ac805e.png","id":121},"a98e76":{"file":"122-a98e76.png","id":122},"aa876c":{"file":"123-aa876c.png","id":123},"9a785e":{"file":"124-9a785e.png","id":124},"b08a4b":{"file":"125-b08a4b.png","id":125},"a17548":{"file":"126-a17548.png","id":126},"806049":{"file":"127-806049.png","id":127},"735550":{"file":"128-735550.png","id":128},"5d3c32":{"file":"129-5d3c32.png","id":129},"41322f":{"file":"130-41322f.png","id":130},"682d2c":{"file":"131-682d2c.png","id":131},"692122":{"file":"132-692122.png","id":132},"9a4544":{"file":"133-9a4544.png","id":133},"863645":{"file":"134-863645.png","id":134},"ef9692":{"file":"135-ef9692.png","id":135},"342a2c":{"file":"136-342a2c.png","id":136},"222629":{"file":"137-222629.png","id":137},"232a42":{"file":"138-232a42.png","id":138},"2b3648":{"file":"139-2b3648.png","id":139},"53598e":{"file":"140-53598e.png","id":140},"9c7d5d":{"file":"141-9c7d5d.png","id":141},"977561":{"file":"142-977561.png","id":142},"9e7b67":{"file":"143-9e7b67.png","id":143},"99784f":{"file":"144-99784f.png","id":144},"6e5045":{"file":"146-6e5045.png","id":146},"634126":{"file":"147-634126.png","id":147},"563824":{"file":"148-563824.png","id":148},"48342b":{"file":"149-48342b.png","id":149},"b06a62":{"file":"150-b06a62.png","id":150},"9e484b":{"file":"151-9e484b.png","id":151},"b0544e":{"file":"152-b0544e.png","id":152},"e4699f":{"file":"153-e4699f.png","id":153},"e991b0":{"file":"154-e991b0.png","id":154},"252526":{"file":"155-252526.png","id":155},"202934":{"file":"156-202934.png","id":156},"2e3b54":{"file":"157-2e3b54.png","id":157},"2e404a":{"file":"158-2e404a.png","id":158},"576e8e":{"file":"159-576e8e.png","id":159},"28487a":{"file":"160-28487a.png","id":160},"9d856b":{"file":"161-9d856b.png","id":161},"96704b":{"file":"162-96704b.png","id":162},"b98d62":{"file":"163-b98d62.png","id":163},"a47041":{"file":"164-a47041.png","id":164},"814230":{"file":"165-814230.png","id":165},"574231":{"file":"166-574231.png","id":166},"443025":{"file":"167-443025.png","id":167},"3f2c25":{"file":"168-3f2c25.png","id":168},"b85650":{"file":"169-b85650.png","id":169},"ad6b45":{"file":"170-ad6b45.png","id":170},"d63c86":{"file":"171-d63c86.png","id":171},"de5693":{"file":"172-de5693.png","id":172},"f59aa5":{"file":"173-f59aa5.png","id":173},"343241":{"file":"174-343241.png","id":174},"2c3742":{"file":"175-2c3742.png","id":175},"263147":{"file":"176-263147.png","id":176},"295074":{"file":"177-295074.png","id":177},"5c70ac":{"file":"178-5c70ac.png","id":178},"3b5d82":{"file":"179-3b5d82.png","id":179},"656d8d":{"file":"180-656d8d.png","id":180},"9f7859":{"file":"181-9f7859.png","id":181},"937144":{"file":"182-937144.png","id":182},"966b44":{"file":"183-966b44.png","id":183},"854b23":{"file":"184-854b23.png","id":184},"713f25":{"file":"185-713f25.png","id":185},"472e26":{"file":"186-472e26.png","id":186},"33251f":{"file":"187-33251f.png","id":187},"984538":{"file":"188-984538.png","id":188},"5d372d":{"file":"189-5d372d.png","id":189},"683d26":{"file":"190-683d26.png","id":190},"f79d84":{"file":"191-f79d84.png","id":191},"e1a59a":{"file":"192-e1a59a.png","id":192},"2b3039":{"file":"193-2b3039.png","id":193},"262d3b":{"file":"194-262d3b.png","id":194},"293b59":{"file":"195-293b59.png","id":195},"355888":{"file":"196-355888.png","id":196},"516076":{"file":"197-516076.png","id":197},"515368":{"file":"198-515368.png","id":198},"4c6082":{"file":"199-4c6082.png","id":199},"4870a0":{"file":"200-4870a0.png","id":200},"9c713a":{"file":"201-9c713a.png","id":201},"b7957a":{"file":"202-b7957a.png","id":202},"a5693f":{"file":"203-a5693f.png","id":203},"804a2e":{"file":"204-804a2e.png","id":204},"603b29":{"file":"205-603b29.png","id":205},"4c3629":{"file":"206-4c3629.png","id":206},"78383a":{"file":"207-78383a.png","id":207},"5a3c20":{"file":"208-5a3c20.png","id":208},"6d3f2d":{"file":"209-6d3f2d.png","id":209},"9f2e26":{"file":"210-9f2e26.png","id":210},"e1b1ac":{"file":"211-e1b1ac.png","id":211},"38383a":{"file":"212-38383a.png","id":212},"2d354a":{"file":"213-2d354a.png","id":213},"333959":{"file":"214-333959.png","id":214},"374974":{"file":"215-374974.png","id":215},"38486e":{"file":"216-38486e.png","id":216},"637585":{"file":"217-637585.png","id":217},"63838a":{"file":"218-63838a.png","id":218},"4e7cbe":{"file":"219-4e7cbe.png","id":219},"7399b3":{"file":"220-7399b3.png","id":220},"ab8b56":{"file":"221-ab8b56.png","id":221},"aa6d32":{"file":"222-aa6d32.png","id":222},"8b4933":{"file":"223-8b4933.png","id":223},"743f33":{"file":"224-743f33.png","id":224},"44332b":{"file":"225-44332b.png","id":225},"9b3d36":{"file":"226-9b3d36.png","id":226},"624229":{"file":"227-624229.png","id":227},"53392d":{"file":"228-53392d.png","id":228},"a73c23":{"file":"229-a73c23.png","id":229},"c33727":{"file":"230-c33727.png","id":230},"3a3c49":{"file":"231-3a3c49.png","id":231},"282829":{"file":"232-282829.png","id":232},"2a3a59":{"file":"233-2a3a59.png","id":233},"334b77":{"file":"234-334b77.png","id":234},"4c77bb":{"file":"235-4c77bb.png","id":235},"405f7d":{"file":"236-405f7d.png","id":236},"588ebd":{"file":"237-588ebd.png","id":237},"527197":{"file":"238-527197.png","id":238},"6d92b3":{"file":"239-6d92b3.png","id":239},"8da0aa":{"file":"240-8da0aa.png","id":240},"8a573a":{"file":"241-8a573a.png","id":241},"8b4b30":{"file":"242-8b4b30.png","id":242},"3e2d26":{"file":"243-3e2d26.png","id":243},"382928":{"file":"244-382928.png","id":244},"86302c":{"file":"245-86302c.png","id":245},"b24933":{"file":"246-b24933.png","id":246},"5a4536":{"file":"247-5a4536.png","id":247},"ca4b28":{"file":"248-ca4b28.png","id":248},"8d4433":{"file":"249-8d4433.png","id":249},"da7a51":{"file":"250-da7a51.png","id":250},"2b2a30":{"file":"251-2b2a30.png","id":251},"334264":{"file":"252-334264.png","id":252},"505a6b":{"file":"253-505a6b.png","id":253},"32479a":{"file":"254-32479a.png","id":254},"3a63a5":{"file":"255-3a63a5.png","id":255},"5288a9":{"file":"256-5288a9.png","id":256},"586679":{"file":"257-586679.png","id":257},"63779b":{"file":"258-63779b.png","id":258},"9f9a9f":{"file":"259-9f9a9f.png","id":259},"98a1ab":{"file":"260-98a1ab.png","id":260},"653628":{"file":"261-653628.png","id":261},"5a382f":{"file":"262-5a382f.png","id":262},"322829":{"file":"263-322829.png","id":263},"7c3630":{"file":"264-7c3630.png","id":264},"793c2c":{"file":"265-793c2c.png","id":265},"483839":{"file":"266-483839.png","id":266},"d85527":{"file":"267-d85527.png","id":267},"ea7033":{"file":"268-ea7033.png","id":268},"c68061":{"file":"269-c68061.png","id":269},"e08862":{"file":"270-e08862.png","id":270},"354b68":{"file":"271-354b68.png","id":271},"4273b9":{"file":"293-4273b9.png","id":293},"4f5f89":{"file":"273-4f5f89.png","id":273},"445998":{"file":"274-445998.png","id":274},"2972a3":{"file":"275-2972a3.png","id":275},"4b668e":{"file":"276-4b668e.png","id":276},"789dd3":{"file":"277-789dd3.png","id":277},"a2b3bd":{"file":"278-a2b3bd.png","id":278},"b4b5b5":{"file":"279-b4b5b5.png","id":279},"cfbab5":{"file":"280-cfbab5.png","id":280},"4a3728":{"file":"281-4a3728.png","id":281},"2a2220":{"file":"282-2a2220.png","id":282},"752e26":{"file":"283-752e26.png","id":283},"70292a":{"file":"284-70292a.png","id":284},"3d3125":{"file":"285-3d3125.png","id":285},"51412b":{"file":"286-51412b.png","id":286},"8d3d2f":{"file":"287-8d3d2f.png","id":287},"f59051":{"file":"288-f59051.png","id":288},"f68b4c":{"file":"289-f68b4c.png","id":289},"fcb448":{"file":"290-fcb448.png","id":290},"5e6a6e":{"file":"291-5e6a6e.png","id":291},"275093":{"file":"292-275093.png","id":292},"4c7094":{"file":"294-4c7094.png","id":294},"5b90ab":{"file":"295-5b90ab.png","id":295},"87a5c2":{"file":"296-87a5c2.png","id":296},"78a0ca":{"file":"297-78a0ca.png","id":297},"a7aab1":{"file":"298-a7aab1.png","id":298},"c4b6ad":{"file":"299-c4b6ad.png","id":299},"d1c0b6":{"file":"300-d1c0b6.png","id":300},"cec798":{"file":"301-cec798.png","id":301},"bfc799":{"file":"302-bfc799.png","id":302},"becfa5":{"file":"303-becfa5.png","id":303},"d2debb":{"file":"304-d2debb.png","id":304},"b7b7ad":{"file":"305-b7b7ad.png","id":305},"81993c":{"file":"306-81993c.png","id":306},"7ea888":{"file":"307-7ea888.png","id":307},"6aa897":{"file":"308-6aa897.png","id":308},"94c4af":{"file":"309-94c4af.png","id":309},"e9debd":{"file":"310-e9debd.png","id":310},"f3f1d7":{"file":"311-f3f1d7.png","id":311},"fdf8e0":{"file":"312-fdf8e0.png","id":312},"fdd7a8":{"file":"313-fdd7a8.png","id":313},"faeabb":{"file":"314-faeabb.png","id":314},"fdc986":{"file":"315-fdc986.png","id":315},"fcc87c":{"file":"316-fcc87c.png","id":316},"faa962":{"file":"317-faa962.png","id":317},"ec5825":{"file":"318-ec5825.png","id":318},"ecae24":{"file":"319-ecae24.png","id":319},"a77a45":{"file":"320-a77a45.png","id":320},"c6caaa":{"file":"321-c6caaa.png","id":321},"afbea6":{"file":"322-afbea6.png","id":322},"9ec4a5":{"file":"323-9ec4a5.png","id":323},"d6e7c9":{"file":"324-d6e7c9.png","id":324},"699754":{"file":"325-699754.png","id":325},"696c40":{"file":"326-696c40.png","id":326},"629c83":{"file":"327-629c83.png","id":327},"6aae9c":{"file":"328-6aae9c.png","id":328},"96cbbe":{"file":"329-96cbbe.png","id":329},"acd0ba":{"file":"330-acd0ba.png","id":330},"f6efca":{"file":"331-f6efca.png","id":331},"ffeac6":{"file":"332-ffeac6.png","id":332},"fbd796":{"file":"333-fbd796.png","id":333},"fedb74":{"file":"334-fedb74.png","id":334},"efc25e":{"file":"335-efc25e.png","id":335},"f1b154":{"file":"336-f1b154.png","id":336},"e46225":{"file":"337-e46225.png","id":337},"e18d26":{"file":"338-e18d26.png","id":338},"9b7940":{"file":"339-9b7940.png","id":339},"b69051":{"file":"340-b69051.png","id":340},"a5c8af":{"file":"341-a5c8af.png","id":341},"b9cbb0":{"file":"342-b9cbb0.png","id":342},"91ad84":{"file":"343-91ad84.png","id":343},"597e49":{"file":"344-597e49.png","id":344},"4a6737":{"file":"345-4a6737.png","id":345},"977d3f":{"file":"346-977d3f.png","id":346},"5d9583":{"file":"347-5d9583.png","id":347},"669185":{"file":"348-669185.png","id":348},"739f86":{"file":"349-739f86.png","id":349},"b6e1d9":{"file":"350-b6e1d9.png","id":350},"fce6a4":{"file":"351-fce6a4.png","id":351},"e4be6a":{"file":"352-e4be6a.png","id":352},"fccc7f":{"file":"353-fccc7f.png","id":353},"fddb6a":{"file":"354-fddb6a.png","id":354},"fdc24e":{"file":"355-fdc24e.png","id":355},"e17927":{"file":"356-e17927.png","id":356},"ea9d21":{"file":"357-ea9d21.png","id":357},"9f7937":{"file":"358-9f7937.png","id":358},"6a492e":{"file":"359-6a492e.png","id":359},"b99153":{"file":"360-b99153.png","id":360},"909a7e":{"file":"361-909a7e.png","id":361},"8aa87c":{"file":"362-8aa87c.png","id":362},"7a8157":{"file":"363-7a8157.png","id":363},"61713a":{"file":"364-61713a.png","id":364},"897e3f":{"file":"365-897e3f.png","id":365},"796b39":{"file":"366-796b39.png","id":366},"547f55":{"file":"367-547f55.png","id":367},"4d7553":{"file":"368-4d7553.png","id":368},"4b7b65":{"file":"369-4b7b65.png","id":369},"569585":{"file":"370-569585.png","id":370},"fde495":{"file":"371-fde495.png","id":371},"f7cd68":{"file":"372-f7cd68.png","id":372},"f7c450":{"file":"373-f7c450.png","id":373},"fed959":{"file":"374-fed959.png","id":374},"f1981f":{"file":"375-f1981f.png","id":375},"d7a528":{"file":"376-d7a528.png","id":376},"d4b571":{"file":"377-d4b571.png","id":377},"c29445":{"file":"378-c29445.png","id":378},"c39e58":{"file":"379-c39e58.png","id":379},"7d5828":{"file":"380-7d5828.png","id":380},"889a80":{"file":"381-889a80.png","id":381},"aea676":{"file":"382-aea676.png","id":382},"cfbf8d":{"file":"383-cfbf8d.png","id":383},"9f9b50":{"file":"384-9f9b50.png","id":384},"5d5737":{"file":"385-5d5737.png","id":385},"636349":{"file":"386-636349.png","id":386},"43634a":{"file":"387-43634a.png","id":387},"5a856a":{"file":"388-5a856a.png","id":388},"3f6657":{"file":"389-3f6657.png","id":389},"3f715b":{"file":"390-3f715b.png","id":390},"fcd785":{"file":"391-fcd785.png","id":391},"fce284":{"file":"392-fce284.png","id":392},"fcda5f":{"file":"393-fcda5f.png","id":393},"f6841f":{"file":"394-f6841f.png","id":394},"f3b418":{"file":"395-f3b418.png","id":395},"e8c473":{"file":"396-e8c473.png","id":396},"cb9136":{"file":"397-cb9136.png","id":397},"966d40":{"file":"398-966d40.png","id":398},"95672f":{"file":"399-95672f.png","id":399},"775937":{"file":"400-775937.png","id":400},"684f2d":{"file":"401-684f2d.png","id":401},"385c38":{"file":"402-385c38.png","id":402},"385831":{"file":"403-385831.png","id":403},"405339":{"file":"404-405339.png","id":404},"485338":{"file":"405-485338.png","id":405},"51553a":{"file":"406-51553a.png","id":406},"3e6b54":{"file":"407-3e6b54.png","id":407},"355d4a":{"file":"408-355d4a.png","id":408},"527d7c":{"file":"409-527d7c.png","id":409},"326069":{"file":"410-326069.png","id":410},"fdeab0":{"file":"411-fdeab0.png","id":411},"fbe46d":{"file":"412-fbe46d.png","id":412},"f89c4f":{"file":"413-f89c4f.png","id":413},"f2b418":{"file":"414-f2b418.png","id":414},"d8b574":{"file":"415-d8b574.png","id":415},"b58935":{"file":"416-b58935.png","id":416},"c69437":{"file":"417-c69437.png","id":417},"9a7144":{"file":"418-9a7144.png","id":418},"77635d":{"file":"419-77635d.png","id":419},"8a6a71":{"file":"420-8a6a71.png","id":420},"56452f":{"file":"421-56452f.png","id":421},"54472a":{"file":"422-54472a.png","id":422},"3b4b37":{"file":"423-3b4b37.png","id":423},"2f4131":{"file":"424-2f4131.png","id":424},"2a4c33":{"file":"425-2a4c33.png","id":425},"555d3c":{"file":"426-555d3c.png","id":426},"6b654f":{"file":"427-6b654f.png","id":427},"96b2bb":{"file":"428-96b2bb.png","id":428},"7aa8bd":{"file":"429-7aa8bd.png","id":429},"45757f":{"file":"430-45757f.png","id":430},"f7e081":{"file":"431-f7e081.png","id":431},"faa847":{"file":"432-faa847.png","id":432},"e6bb1f":{"file":"433-e6bb1f.png","id":433},"e6b558":{"file":"434-e6b558.png","id":434},"a56e34":{"file":"435-a56e34.png","id":435},"c38f30":{"file":"436-c38f30.png","id":436},"e2a84c":{"file":"437-e2a84c.png","id":437},"885e2b":{"file":"438-885e2b.png","id":438},"b28f86":{"file":"439-b28f86.png","id":439},"bdaea6":{"file":"440-bdaea6.png","id":440},"4f4529":{"file":"441-4f4529.png","id":441},"573c31":{"file":"442-573c31.png","id":442},"564832":{"file":"443-564832.png","id":443},"292f28":{"file":"444-292f28.png","id":444},"314235":{"file":"445-314235.png","id":445},"495546":{"file":"446-495546.png","id":446},"87a8bc":{"file":"447-87a8bc.png","id":447},"98b7c9":{"file":"448-98b7c9.png","id":448},"9ecccf":{"file":"449-9ecccf.png","id":449},"8fbcd4":{"file":"450-8fbcd4.png","id":450},"f99f3e":{"file":"451-f99f3e.png","id":451},"f6d02a":{"file":"452-f6d02a.png","id":452},"d1a254":{"file":"453-d1a254.png","id":453},"a26b28":{"file":"454-a26b28.png","id":454},"846131":{"file":"455-846131.png","id":455},"a4723e":{"file":"456-a4723e.png","id":456},"87672e":{"file":"457-87672e.png","id":457},"987976":{"file":"458-987976.png","id":458},"b79a91":{"file":"459-b79a91.png","id":459},"7c736d":{"file":"460-7c736d.png","id":460},"5e4e2f":{"file":"461-5e4e2f.png","id":461},"4d4120":{"file":"462-4d4120.png","id":462},"413b23":{"file":"463-413b23.png","id":463},"635432":{"file":"464-635432.png","id":464},"98b9c6":{"file":"465-98b9c6.png","id":465},"a1b8c6":{"file":"466-a1b8c6.png","id":466},"93b8c4":{"file":"467-93b8c4.png","id":467},"a1b9bb":{"file":"468-a1b9bb.png","id":468},"b5beb1":{"file":"469-b5beb1.png","id":469},"cfcfce":{"file":"470-cfcfce.png","id":470},"f7cd1d":{"file":"471-f7cd1d.png","id":471},"af8a35":{"file":"472-af8a35.png","id":472},"bd8139":{"file":"473-bd8139.png","id":473},"946b42":{"file":"474-946b42.png","id":474},"8d6948":{"file":"475-8d6948.png","id":475},"95724c":{"file":"476-95724c.png","id":476},"b48fa1":{"file":"477-b48fa1.png","id":477},"6e5b5d":{"file":"478-6e5b5d.png","id":478},"a39594":{"file":"479-a39594.png","id":479},"8a7b70":{"file":"480-8a7b70.png","id":480},"564826":{"file":"481-564826.png","id":481},"50412a":{"file":"482-50412a.png","id":482},"46402a":{"file":"483-46402a.png","id":483},"504b36":{"file":"484-504b36.png","id":484},"434327":{"file":"485-434327.png","id":485},"7a9ea4":{"file":"486-7a9ea4.png","id":486},"899692":{"file":"487-899692.png","id":487},"a7b0a3":{"file":"488-a7b0a3.png","id":488},"a3b9b2":{"file":"489-a3b9b2.png","id":489},"babfbb":{"file":"490-babfbb.png","id":490},"d98f28":{"file":"491-d98f28.png","id":491},"c88443":{"file":"492-c88443.png","id":492},"a77329":{"file":"493-a77329.png","id":493},"916c29":{"file":"494-916c29.png","id":494},"6e523c":{"file":"495-6e523c.png","id":495},"998598":{"file":"496-998598.png","id":496},"c0ad9d":{"file":"497-c0ad9d.png","id":497},"c8b8b5":{"file":"498-c8b8b5.png","id":498},"6c6c63":{"file":"499-6c6c63.png","id":499},"565459":{"file":"500-565459.png","id":500},"967d59":{"file":"501-967d59.png","id":501},"847554":{"file":"502-847554.png","id":502},"9a7749":{"file":"503-9a7749.png","id":503},"796044":{"file":"504-796044.png","id":504},"6a584a":{"file":"505-6a584a.png","id":505},"434947":{"file":"506-434947.png","id":506},"42423c":{"file":"507-42423c.png","id":507},"464741":{"file":"508-464741.png","id":508},"788475":{"file":"509-788475.png","id":509},"7d8075":{"file":"510-7d8075.png","id":510},"a15c26":{"file":"511-a15c26.png","id":511},"905924":{"file":"512-905924.png","id":512},"906a3b":{"file":"513-906a3b.png","id":513},"997c9b":{"file":"514-997c9b.png","id":514},"a6989e":{"file":"515-a6989e.png","id":515},"a5978c":{"file":"516-a5978c.png","id":516},"9d8e86":{"file":"517-9d8e86.png","id":517},"626169":{"file":"518-626169.png","id":518},"5e5d65":{"file":"519-5e5d65.png","id":519},"454446":{"file":"520-454446.png","id":520},"7d6646":{"file":"521-7d6646.png","id":521},"8e7145":{"file":"522-8e7145.png","id":522},"785f4c":{"file":"523-785f4c.png","id":523},"887651":{"file":"524-887651.png","id":524},"6f6450":{"file":"525-6f6450.png","id":525},"373e39":{"file":"527-373e39.png","id":527},"434942":{"file":"528-434942.png","id":528},"6f7062":{"file":"529-6f7062.png","id":529},"65725c":{"file":"530-65725c.png","id":530},"8f6329":{"file":"531-8f6329.png","id":531},"a56227":{"file":"532-a56227.png","id":532},"65596d":{"file":"533-65596d.png","id":533},"a78ea1":{"file":"534-a78ea1.png","id":534},"9998b7":{"file":"535-9998b7.png","id":535},"a7a39e":{"file":"536-a7a39e.png","id":536},"8f8a8e":{"file":"537-8f8a8e.png","id":537},"635e65":{"file":"538-635e65.png","id":538},"504a4a":{"file":"539-504a4a.png","id":539},"3d3e42":{"file":"540-3d3e42.png","id":540},"7b6244":{"file":"541-7b6244.png","id":541},"6e5840":{"file":"542-6e5840.png","id":542},"624d35":{"file":"543-624d35.png","id":543},"473e30":{"file":"544-473e30.png","id":544},"493922":{"file":"545-493922.png","id":545},"5c5444":{"file":"546-5c5444.png","id":546},"413d32":{"file":"547-413d32.png","id":547},"4e4d3e":{"file":"548-4e4d3e.png","id":548},"a5a497":{"file":"549-a5a497.png","id":549},"878a79":{"file":"550-878a79.png","id":550},"494036":{"file":"551-494036.png","id":551},"493e55":{"file":"552-493e55.png","id":552},"574768":{"file":"553-574768.png","id":553},"6a6684":{"file":"554-6a6684.png","id":554},"8a888b":{"file":"555-8a888b.png","id":555},"63646e":{"file":"556-63646e.png","id":556},"464543":{"file":"557-464543.png","id":557},"403f3f":{"file":"558-403f3f.png","id":558},"42424b":{"file":"559-42424b.png","id":559},"333134":{"file":"560-333134.png","id":560},"655139":{"file":"561-655139.png","id":561},"625038":{"file":"562-625038.png","id":562},"4a4332":{"file":"563-4a4332.png","id":563},"4e3f26":{"file":"564-4e3f26.png","id":564},"765b2f":{"file":"565-765b2f.png","id":565},"5f5949":{"file":"566-5f5949.png","id":566},"675d50":{"file":"567-675d50.png","id":567},"78756c":{"file":"568-78756c.png","id":568},"d0ad9e":{"file":"569-d0ad9e.png","id":569},"b4a087":{"file":"570-b4a087.png","id":570},"44384c":{"file":"571-44384c.png","id":571},"513d48":{"file":"572-513d48.png","id":572},"5a4e64":{"file":"573-5a4e64.png","id":573},"ccb4a9":{"file":"574-ccb4a9.png","id":574},"b1a3a2":{"file":"575-b1a3a2.png","id":575},"777379":{"file":"576-777379.png","id":576},"393936":{"file":"577-393936.png","id":577},"3b3745":{"file":"578-3b3745.png","id":578},"4c464d":{"file":"579-4c464d.png","id":579},"141416":{"file":"580-141416.png","id":580},"4c4130":{"file":"581-4c4130.png","id":581},"322e25":{"file":"582-322e25.png","id":582},"4e3c26":{"file":"583-4e3c26.png","id":583},"6d5332":{"file":"584-6d5332.png","id":584},"83662d":{"file":"585-83662d.png","id":585},"716960":{"file":"586-716960.png","id":586},"746e58":{"file":"587-746e58.png","id":587},"beb09d":{"file":"588-beb09d.png","id":588},"c5b2a4":{"file":"589-c5b2a4.png","id":589},"ccb7a4":{"file":"590-ccb7a4.png","id":590},"392e3f":{"file":"591-392e3f.png","id":591},"533b48":{"file":"592-533b48.png","id":592},"a4a2af":{"file":"593-a4a2af.png","id":593},"b3a3a3":{"file":"594-b3a3a3.png","id":594},"726d71":{"file":"595-726d71.png","id":595},"585a5e":{"file":"596-585a5e.png","id":596},"313036":{"file":"597-313036.png","id":597},"2b2a2d":{"file":"598-2b2a2d.png","id":598},"141718":{"file":"599-141718.png","id":599},"131617":{"file":"600-131617.png","id":600}}';
     $sw = json_decode($sw, true);
     foreach ($sw as $k => $v) {
         $bg = new Imagick();
         $bg->newImage(100, 136, new ImagickPixel("#" . $k));
         $bg->setimageformat('png');
         $fl = new Imagick("img/ARS_300.png");
         $fl->compositeimage($bg, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
         $fl->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
         $fl->compositeimage(new Imagick("img/ARS_300.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
         $fl->scaleimage(0, 60);
         $fl->setimageformat("png");
         $fl->setImageFileName("tom/" . $k . ".png");
         $fl->setinterlacescheme(\Imagick::INTERLACE_PNG);
         $fl->writeimage();
         $fl->destroy();
     }
     exit;
 }
 public function createThali($dishArray = array(), $is_thali, $w = 140, $h = 0)
 {
     Configure::write('debug', 2);
     ini_set("max_execution_time", -1);
     $thali1 = new Imagick("tmpl/img/thali-1.png");
     $thali2 = new Imagick("tmpl/img/thali-2.png");
     $thali3 = new Imagick("tmpl/img/thali-3.png");
     $mask_1 = new Imagick("tmpl/img/thali-mask2.png");
     $mask_2 = new Imagick("tmpl/img/thali-mask3.png");
     if (!is_array($dishArray)) {
         return false;
     }
     $mask_cnt = 0;
     foreach ($dishArray as $dish) {
         if ($mask_cnt > 1) {
             // Mask Locking (Modify if masks will be increased or decreased)
             break;
         }
         $dish = new Imagick($dish);
         $dish->scaleimage($thali1->getimagewidth(), $thali1->getimageheight());
         // Set As per bowl image
         if ($is_thali) {
             if ($mask_cnt == 1) {
                 $dish->rotateimage("#fff", 180);
             }
             $dish->compositeimage(new Imagick("tmpl/img/thali-mask" . ($mask_cnt + 2) . ".png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
             $dish->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
             $thali1->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
             $thali1->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
             $thali2->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
             $thali2->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
             $thali3->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
             $thali3->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
         } else {
             $thali3 = $dish;
         }
         $mask_cnt++;
     }
     $url = "files/thali_images/" . $this->randomString(6);
     $url_end = "-Thali.jpg";
     $result_urls = array();
     $thali1->setimageformat("jpg");
     $thali1->setImageFileName($result_urls[] = $url . "-0" . $url_end);
     $thali1->scaleimage($w, $h);
     if ($is_thali) {
         $thali2->writeimage();
     }
     $thali1->destroy();
     $thali2->setimageformat("jpg");
     $thali2->setImageFileName($result_urls[] = $url . "-1" . $url_end);
     $thali2->scaleimage($w, $h);
     if ($is_thali) {
         $thali2->writeimage();
     }
     $thali2->destroy();
     $thali3->setimageformat("jpg");
     $thali3->setImageFileName($result_urls[] = $url . "-2" . $url_end);
     $thali3->scaleimage($w, $h);
     $thali3->writeimage();
     $thali3->destroy();
     return $result_urls;
 }
/**
 * Get the average pixel colour from the given file using Image Magick
 * 
 * @param string $filename
 * @param bool $as_hex      Set to true, the function will return the 6 character HEX value of the colour.    
 *                          If false, an array will be returned with r, g, b components.
 */
function get_average_colour($filename, $as_hex_string = true)
{
    try {
        // Read image file with Image Magick
        $image = new Imagick($filename);
        // Scale down to 1x1 pixel to make Imagick do the average
        $image->scaleimage(1, 1);
        /** @var ImagickPixel $pixel */
        if (!($pixels = $image->getimagehistogram())) {
            return null;
        }
    } catch (ImagickException $e) {
        // Image Magick Error!
        return null;
    } catch (Exception $e) {
        // Unknown Error!
        return null;
    }
    $pixel = reset($pixels);
    $rgb = $pixel->getcolor();
    if ($as_hex_string) {
        return sprintf('%02X%02X%02X', $rgb['r'], $rgb['g'], $rgb['b']);
    }
    return $rgb;
}
Exemple #4
0
function resizeImage($imagePath, $width, $height, $filterType, $blur, $bestFit, $cropZoom)
{
    //The blur factor where > 1 is blurry, < 1 is sharp.
    $imagick = new \Imagick(realpath($imagePath));
    $imagick->resizeImage($width, $height, $filterType, $blur, $bestFit);
    $cropWidth = $imagick->getImageWidth();
    $cropHeight = $imagick->getImageHeight();
    if ($cropZoom) {
        $newWidth = $cropWidth / 2;
        $newHeight = $cropHeight / 2;
        $imagick->cropimage($newWidth, $newHeight, ($cropWidth - $newWidth) / 2, ($cropHeight - $newHeight) / 2);
        $imagick->scaleimage($imagick->getImageWidth() * 4, $imagick->getImageHeight() * 4);
    }
    header("Content-Type: image/jpg");
    echo $imagick->getImageBlob();
}
Exemple #5
0
 /**
  * Resizes an image image
  * @return boolean
  */
 public function resize()
 {
     try {
         // Create new Image object //
         $im = new Imagick($this->image->get('image_path'));
         // Resize the image //
         $im->scaleimage($this->image->get('height'), $this->image->get('width'));
         // Grab the output from writing the image to disk //
         $return = $im->writeimage($this->image->get('resized_path'));
         // Clean up memory //
         $im->clear();
         $im->destroy();
         // $return only returns true if image is written //
         return $return ? true : false;
     } catch (Exception $e) {
         $this->log->exceptionLog($e, __METHOD__);
     }
 }
 public function beforeSave($options = array())
 {
     Configure::write('debug', 2);
     parent::beforeSave($options);
     if (isset($this->data[$this->alias]['cash_by_promo'])) {
         if ($this->data[$this->alias]['cash_by_promo'] > 120) {
             unset($this->data[$this->alias]['cash_by_promo']);
             //HackPreventions
         }
     }
     if (isset($this->data[$this->alias]['password'])) {
         $this->data[$this->alias]['v_code'] = $this->data[$this->alias]['password'];
         $this->data[$this->alias]['password'] = AuthComponent::password($this->data[$this->alias]['password']);
     }
     if (isset($this->data[$this->alias]['image'])) {
         App::uses("HtmlHelper", "View/Helper");
         $html = new HtmlHelper(new View());
         if (isset($this->data[$this->alias]['image']['name'])) {
             if (isset($this->data[$this->alias]['image']['size'])) {
                 if (isset($this->data[$this->alias]['id'])) {
                     $fx = $this->find("first", array("contain" => false, "conditions" => array("Customer.id" => $this->data[$this->alias]['id'])));
                     $fn = ltrim($fx[$this->alias]['image'], "https://www.pickmeals.com/");
                     @unlink($fn);
                 }
                 $ext = pathinfo($this->data[$this->alias]['image']['name'], PATHINFO_EXTENSION);
                 $image_name = date('YmdHis') . rand(1, 999) . "." . $ext;
                 $path = $this->data[$this->alias]['image']['tmp_name'];
                 $this->data[$this->alias]['image'] = $html->url("/files/profile_image/" . $image_name, true);
                 $destination = "files/profile_image/" . $image_name;
                 move_uploaded_file($path, $destination);
                 $im = new Imagick($destination);
                 $im->scaleimage(800, 0);
                 $im->writeimage($destination);
                 $im->destroy();
             }
         }
     }
     return TRUE;
 }
Exemple #7
0
function createBowl($dishUrl = null, $w = 140, $h = 0)
{
    $du = explode("/", $dishUrl);
    $du = explode(".", $du[count($du) - 1]);
    $uri = $du[count($du) - 2];
    $bowl = new Imagick("img/bowl.png");
    $mask = new Imagick("img/mask.png");
    $dish = new Imagick($dishUrl);
    $dish->scaleimage($bowl->getimagewidth(), $bowl->getimageheight());
    // Set As per bowl image
    $dish->compositeimage(new Imagick("img/mask.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
    $dish->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
    $bowl->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
    $bowl->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
    $bowl->setimageformat("jpg");
    $bowl->setImageFileName($url = "gen/" . $uri . ".jpg");
    //    $bowl->setinterlacescheme(\Imagick::INTERLACE_PNG);
    $bowl->scaleimage($w, $h);
    $bowl->writeimage();
    $bowl->destroy();
    return $url;
}
 /**
  * @param $watermarkImage
  * @param int $positionX
  * @param int $positionY
  * @param int $watermarkImageOpacity
  * @param bool $repeat
  */
 public function watermark($watermarkImage, $positionX = 0, $positionY = 0, $watermarkImageOpacity = 30, $repeat = false)
 {
     Varien_Profiler::start(__METHOD__);
     /** @var $watermark Imagick */
     $watermark = new Imagick($watermarkImage);
     //better method to blow up small images.
     $watermark->setimageinterpolatemethod(Imagick::INTERPOLATE_NEARESTNEIGHBOR);
     if ($this->_watermarkImageOpacity == null) {
         $opc = $watermarkImageOpacity;
     } else {
         $opc = $this->getWatermarkImageOpacity();
     }
     $watermark->evaluateImage(Imagick::EVALUATE_MULTIPLY, $opc, Imagick::CHANNEL_ALPHA);
     // how big are the images?
     $iWidth = $this->getImageMagick()->getImageWidth();
     $iHeight = $this->getImageMagick()->getImageHeight();
     //resize watermark to configuration size
     if ($this->getWatermarkWidth() && $this->getWatermarkHeigth() && $this->getWatermarkPosition() != self::POSITION_STRETCH) {
         $watermark->scaleImage($this->getWatermarkWidth(), $this->getWatermarkHeigth());
     }
     // get watermark size
     $wWidth = $watermark->getImageWidth();
     $wHeight = $watermark->getImageHeight();
     //check if watermark is still bigger then image.
     if ($iHeight < $wHeight || $iWidth < $wWidth) {
         // resize the watermark
         $watermark->scaleImage($iWidth, $iHeight);
         // get new size
         $wWidth = $watermark->getImageWidth();
         $wHeight = $watermark->getImageHeight();
     }
     $x = 0;
     $y = 0;
     switch ($this->getWatermarkPosition()) {
         case self::POSITION_CENTER:
             $x = ($iWidth - $wWidth) / 2;
             $y = ($iHeight - $wHeight) / 2;
             break;
         case self::POSITION_STRETCH:
             $watermark->scaleimage($iWidth, $iHeight);
             break;
         case self::POSITION_TOP_RIGHT:
             $x = $iWidth - $wWidth;
             break;
         case self::POSITION_BOTTOM_LEFT:
             $y = $iHeight - $wHeight;
             break;
         case self::POSITION_BOTTOM_RIGHT:
             $x = $iWidth - $wWidth;
             $y = $iHeight - $wHeight;
             break;
         default:
             break;
     }
     $this->getImageMagick()->compositeImage($watermark, Imagick::COMPOSITE_OVER, $x, $y);
     $watermark->clear();
     $watermark->destroy();
     Varien_Profiler::stop(__METHOD__);
 }
Exemple #9
0
 /**
  * 
  * @param string $dishUrl
  * @param int $w Width of the Output Image
  * @param int $h Height of Output Image
  * @return string Path of genrated Image
  */
 public function createBowl($dishUrl = null, $w = 140, $h = 0)
 {
     $bowl = new Imagick("tmpl/img/bowl.png");
     $mask = new Imagick("tmpl/img/mask.png");
     $dish = new Imagick($dishUrl);
     $dish->scaleimage($bowl->getimagewidth(), $bowl->getimageheight());
     // Set As per bowl image
     $dish->compositeimage(new Imagick("tmpl/img/mask.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
     $dish->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $bowl->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
     $bowl->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $bowl->setimageformat("jpg");
     $bowl->setImageFileName($url = "img_tmp/" . $this->randomString(10) . "-GE.jpg");
     //    $bowl->setinterlacescheme(\Imagick::INTERLACE_PNG);
     $bowl->scaleimage($w, $h);
     $bowl->writeimage();
     $bowl->destroy();
     return $url;
 }
 public function ScaledImg($cols, $rows)
 {
     parent::scaleimage($cols, $rows);
 }
$image = null;
if (!empty($_REQUEST["Id"]) && ($EnId = intval($_REQUEST["Id"]))) {
    if (!empty($_REQUEST["picDelete"])) {
        safe_w_sql("DELETE FROM Photos WHERE PhEnId={$EnId}");
    }
    if (!empty($_REQUEST["picEncoded"])) {
        $picEncoded = str_replace(array('data:image/png;base64,', ' '), array('', '+'), $_REQUEST["picEncoded"]);
        $im = new Imagick();
        $im->setFormat('jpg');
        if ($im->readImageBlob(base64_decode($picEncoded))) {
            $w = $im->getImageWidth();
            $h = $im->getimageheight();
            // 			echo $w . "." . $h;exit;
            if ($w != MAX_WIDTH or $h != MAX_HEIGHT) {
                // resize image
                $im->scaleimage($w / $h < MAX_WIDTH / MAX_HEIGHT ? MAX_WIDTH : 0, $w / $h < MAX_WIDTH / MAX_HEIGHT ? 0 : MAX_HEIGHT);
                $w = $im->getImageWidth();
                $h = $im->getimageheight();
                $im->cropimage(MAX_WIDTH, MAX_HEIGHT, ($w - MAX_WIDTH) / 2, ($h - MAX_HEIGHT) / 2);
            }
            $imgtoSave = StrSafe_DB(base64_encode($im->getImageBlob()));
            safe_w_sql("insert into Photos set PhEnId={$EnId}, PhPhoto={$imgtoSave} on duplicate key update PhPhoto={$imgtoSave}");
            require_once 'Common/CheckPictures.php';
            updatePhoto($EnId);
        }
    }
    $Sql = "SELECT EnId, CONCAT(EnDivision, '-',EnClass) as Category, CONCAT(CoName, ' (' ,CoCode,')') as Country, CONCAT(UPPER(EnFirstName),' ' ,EnName) as Athlete, PhPhoto as Photo " . "FROM Entries " . "LEFT JOIN Countries ON EnCountry=CoId " . "LEFT JOIN Photos ON EnId=PhEnId " . "WHERE EnTournament=" . StrSafe_DB($_SESSION['TourId']) . " AND EnId=" . StrSafe_DB($_REQUEST['Id']);
    $Rs = safe_r_sql($Sql);
    if (safe_num_rows($Rs)) {
        $row = safe_fetch($Rs);
        $Answer .= '<athlete>' . '<id>' . $row->EnId . '</id>' . '<ath><![CDATA[' . $row->Athlete . ']]></ath>' . '<team><![CDATA[' . $row->Country . ']]></team>' . '<cat><![CDATA[' . $row->Category . ']]></cat>' . '<pic><![CDATA[' . ($row->Photo ? "data:image/jpeg;base64," . $row->Photo : '') . ']]></pic>' . '</athlete>';
 private function genImgRunner($rugpngs, $colors = array(), $location = "files/temp/")
 {
     if (is_file($location . "runner.png")) {
         return $location;
     }
     ini_set("max_execution_time", -1);
     $layers = array();
     $bg = null;
     foreach ($rugpngs as $rp) {
         if ($rp['type'] == "LAYER") {
             $layers[] = new Imagick($rp['path']);
         } else {
             $bg = new Imagick($rp['path']);
         }
     }
     if ($bg == NULL) {
         $bg = new Imagick();
         $bg->newImage(910, 475, new ImagickPixel('none'));
         $bg->setimageformat('png');
     }
     foreach ($layers as $layer) {
         //$layer->resizeImage(910, 475, Imagick::FILTER_LANCZOS, 1, TRUE);
         $layer->setimageformat("png");
     }
     $bg->resizeImage($layer->getimagewidth(), $layer->getimageheight(), Imagick::FILTER_LANCZOS, 1, TRUE);
     $bg->setimageformat("png");
     $cnt_a = 0;
     foreach ($layers as $layer) {
         $layer->paintopaqueimage(new ImagickPixel('#000'), $colors[$cnt_a], 900000);
         $bg->compositeimage($layer, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
         $cnt_a++;
         $layer->destroy();
     }
     $bg->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $bg = $this->getBgPresp($bg, 60);
     $rnd = new Imagick("files/templates/new/runner/angle.png");
     $bg->scaleimage(0, $rnd->getimageheight());
     $rnd->compositeimage($bg, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
     $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $rnd->compositeimage(new Imagick("files/templates/new/runner/angle_trim.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
     $rnd->setimageformat("png");
     $rnd->setImageFileName($location . "runner.png");
     $rnd->setinterlacescheme(\Imagick::INTERLACE_PNG);
     $rnd->scaleimage(733, 0);
     $rnd->writeimage();
     $rnd->destroy();
     $rnd = new Imagick("files/templates/new/runner/flip.png");
     $bg->scaleimage(0, $rnd->getimageheight());
     $rnd->compositeimage($bg, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
     $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $rnd->compositeimage(new Imagick("files/templates/new/runner/flip_trim.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
     $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $rnd->compositeimage(new Imagick("files/templates/new/runner/flip.png"), \Imagick::COMPOSITE_DSTOVER, 0, 0, Imagick::CHANNEL_ALPHA);
     $rnd->setimageformat("png");
     $rnd->setImageFileName($location . "runner1.png");
     $rnd->setinterlacescheme(\Imagick::INTERLACE_PNG);
     $rnd->scaleimage(733, 0);
     $rnd->writeimage();
     $rnd->destroy();
     $rnd = new Imagick("files/templates/new/runner/straight.png");
     $bg->scaleimage($rnd->getimagewidth(), 0);
     $rnd->compositeimage($bg, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
     $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     $rnd->compositeimage(new Imagick("files/templates/new/runner/straight_trim.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
     $rnd->setimageformat("png");
     $rnd->setImageFileName($location . "runner2.png");
     $rnd->setinterlacescheme(\Imagick::INTERLACE_PNG);
     $rnd->scaleimage(733, 0);
     $rnd->writeimage();
     $rnd->destroy();
     /*
      $rnd = new Imagick("files/templates/runner/runners-4.png");
      $rnd->compositeimage($bg, \Imagick::COMPOSITE_MULTIPLY, 0, 200);
      $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
     
      $rnd->compositeimage(new Imagick("files/templates/runner/runners-4.png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
      $rnd->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
      $rnd->compositeimage(new Imagick("files/templates/runner/runners-5.png"), \Imagick::COMPOSITE_DEFAULT, 0, 0, Imagick::CHANNEL_ALPHA);
      $rnd->setimageformat("png");
      $rnd->setImageFileName($location . "runner3.png");
      $rnd->writeimage();
      $rnd->destroy();
     */
     return $location;
 }
 public function createThali($dishArray = array(), $w = 140, $h = 0)
 {
     Configure::write('debug', 2);
     ini_set("max_execution_time", -1);
     $thali = new Imagick("tmpl/img/thali.png");
     $mask_1 = new Imagick("tmpl/img/thali-mask1.png");
     $mask_2 = new Imagick("tmpl/img/thali-mask2.png");
     $mask_3 = new Imagick("tmpl/img/thali-mask3.png");
     $mask_4 = new Imagick("tmpl/img/thali-mask4.png");
     $mask_5 = new Imagick("tmpl/img/thali-mask5.png");
     if (!is_array($dishArray)) {
         return false;
     }
     $mask_cnt = 0;
     foreach ($dishArray as $dish) {
         if ($mask_cnt > 4) {
             // Mask Locking (Modify if masks will be increased or decreased)
             break;
         }
         $dish = new Imagick($dish);
         if ($mask_cnt + 1 == 5) {
             $dish = new Imagick("tmpl/dishes/rice.jpg");
             // Fixed Rice for Mask No. 1
         }
         $dish->scaleimage($thali->getimagewidth(), $thali->getimageheight());
         // Set As per bowl image
         $dish->compositeimage(new Imagick("tmpl/img/thali-mask" . ($mask_cnt + 1) . ".png"), \Imagick::COMPOSITE_COPYOPACITY, 0, 0, Imagick::CHANNEL_ALPHA);
         $dish->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
         $thali->compositeimage($dish, \Imagick::COMPOSITE_ATOP, 0, 0, Imagick::CHANNEL_ALPHA);
         $thali->mergeimagelayers(Imagick::LAYERMETHOD_COALESCE);
         $mask_cnt++;
     }
     $thali->setimageformat("jpg");
     $thali->setImageFileName($url = "files/thali_images/" . $this->randomString(6) . "-Thali.jpg");
     //    $thali->setinterlacescheme(\Imagick::INTERLACE_PNG);
     $thali->scaleimage($w, $h);
     $thali->writeimage();
     $thali->destroy();
     return $url;
 }
Exemple #14
0
/**
 * Generates a render of schedule's SVG. The PNG render of the image will be
 * stored in /img/schedules/ with a filename equal to the id of the schedule.
 * @param   $svg    string  The SVG code for the image
 * @param   $id     string  The ID of the schedule, for file name generation
 * @return  bool    True on success, False otherwise.
 */
function renderSvg($svg, $id)
{
    try {
        // Prepend parsing info
        $svg = preg_replace('/(.*<svg[^>]* width=")(100\\%)(.*)/', '${1}1000px${3}', $svg);
        $svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $svg;
        // Load the image into an ImageMagick object
        $im = new Imagick();
        $im->readimageblob($svg);
        // Convert it to png
        $im->setImageFormat("png24");
        $im->scaleimage(1000, 600, true);
        // Write it to the filesystem
        $im->writeimage("../img/schedules/{$id}.png");
        $im->clear();
        $im->destroy();
        // Success!
        return true;
    } catch (Exception $e) {
        return false;
    }
}
 public function cropImg()
 {
     //Configure::write('debug', 2);
     if ($this->request->is(array("ajax", "post"))) {
         $d = $this->request->data;
         $url = ltrim($d['uri'], "https://www.pickmeals.com/");
         $im = new Imagick($url);
         $im->cropimage($d['w'], $d['h'], $d['x'], $d['y']);
         $im->scaleimage(253, 0);
         $im->writeimage($url);
         $im->destroy();
         $this->autoRender = false;
         $this->response->type('json');
         $this->response->body(json_encode(array("error" => 0)));
     } else {
         exit;
     }
 }