File tree Expand file tree Collapse file tree
app/Http/Controllers/API/v3/FontAwesome/v6 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,4 +62,39 @@ protected function showIconPin(Request $request)
6262
6363 return response ($ mapMarkerMarkup )->header ('Content-Type ' , 'image/svg+xml ' );
6464 }
65+
66+ protected function showTextPin (Request $ request )
67+ {
68+ // GET MARKER CONFIG
69+ $ markerSize = $ request ->get ('size ' , 100 );
70+
71+ // TEXT
72+ $ text = $ request ->get ('text ' , '' );
73+ $ textSize = $ markerSize / 3.00 ;
74+ $ textFont = 'Arial ' ;
75+ $ textFontColor = '# ' .$ request ->get ('color ' , '000 ' );
76+
77+ // BACKGROUND ICON
78+ $ backgroundIcon = 'fa-solid fa-location-pin ' ;
79+ $ backgroundIconColor = '# ' .$ request ->get ('background ' , 'CCC ' );
80+ $ backgroundIconMarkup = GetIconMarkup ::run ($ backgroundIcon );
81+
82+ // LABEL
83+ $ labelMarkup = GetLabelMarkup ::run (request: $ request , markerSize: $ markerSize );
84+
85+ $ mapMarkerMarkup = <<<EOD
86+ <svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 100 100" width=" {$ markerSize }" height=" {$ markerSize }">
87+ <!--! Generated with MapMarker.io - https://mapmarker.io License - https://www.mapmarker.io/license -->
88+ <svg fill=" {$ backgroundIconColor }">
89+ {$ backgroundIconMarkup }
90+ </svg>
91+
92+ <text x="50%" y="30%" fill=" {$ textFontColor }" text-anchor="middle" dy=".5em" font-size=" {$ textSize }" font-family=" {$ textFont }"> {$ text }</text>
93+
94+ {$ labelMarkup }
95+ </svg>
96+ EOD ;
97+
98+ return response ($ mapMarkerMarkup )->header ('Content-Type ' , 'image/svg+xml ' );
99+ }
65100}
You can’t perform that action at this time.
0 commit comments