0
我正在使用Laravel。我正在嘗試使用Imgix排版端點將生物圖像的職員生物展現出來。當我單獨使用排版端點時,我會得到正確的格式化文本。但是,當我編碼base64然後附加到生物圖像uri,圖像看起來很好,但沒有文字覆蓋。有誰知道我做錯了什麼?爲什麼不使用Imgix排版端點正確覆蓋
下面是函數
public function bioEncode($bio, $align) {
$bioNoSpaces = str_replace(' ', '+', $bio);
$bioTextUrl = base64_encode("http://newsong.imgix.net/~text?txt=" . $bioNoSpaces . "&txtclr=fff&txtsize=20&w=800&txtpad=20&txtfont=avenir-black&txtalign=center");
if($align == 0) {
$newUrl = "http://newsong.imgix.net/staffProfile/cameron-profile-desktop.jpg?fit=crop&crop=top&w=1220&h=500&mark64=" . $bioTextUrl . "&markalign=left,middle&markpad=0";
return $newUrl;
} else {
$newUrl = "http://newsong.imgix.net/staffProfile/cameron-profile-desktop.jpg?fit=crop&crop=top&w=1220&h=500&mark64=" . $bioTextUrl . "&markalign=right,middle&markpad=0";
return $newUrl;
}
}
這裏是我打電話的功能
srcset="{{$staff->bioEncode($staff->staff_bio, $staff->desktop_img_text_side)}}"
進入這個時候
進入Imgix沙盒:https://sandbox.imgix.com/create 此網址的作品。我編碼並解碼了base64字符串,似乎沒有錯。
我還是新來的Php,所以任何幫助都非常感謝。