DEBUG MODE OFF
This commit is contained in:
parent
f15f8dcef2
commit
ab017b8584
2 changed files with 7 additions and 9 deletions
|
@ -106,11 +106,8 @@ func (t Telegram) SendPhoto(data tg.ClientPhotoData) {
|
|||
|
||||
req.Header.Add("Content-Type", writer.FormDataContentType())
|
||||
|
||||
resp, err := client.Do(req)
|
||||
_, err = client.Do(req)
|
||||
checkerr("SendPhoto/http.Do", err)
|
||||
defer resp.Body.Close()
|
||||
respbytes, _ := ioutil.ReadAll(resp.Body)
|
||||
fmt.Println(string(respbytes))
|
||||
}
|
||||
|
||||
// GetFile sends a "getFile" API call to Telegram's servers and fetches the file
|
||||
|
|
|
@ -98,7 +98,7 @@ func memegen(broker *tg.Broker, update tg.APIMessage) {
|
|||
gc.Save()
|
||||
|
||||
// Detect appropriate font size
|
||||
scale := iwidth / iheight * 200
|
||||
scale := iheight / iwidth * (iwidth / 10)
|
||||
gc.SetFontSize(scale)
|
||||
gc.SetLineWidth(scale / 15)
|
||||
|
||||
|
@ -127,15 +127,16 @@ func memegen(broker *tg.Broker, update tg.APIMessage) {
|
|||
// Still too big? Decrease font size again
|
||||
iter := 0
|
||||
for width > iwidth && iter < 10 {
|
||||
left, _, right, _ = gc.GetStringBounds(texts[longid])
|
||||
gc.SetFontSize(scale * 0.8)
|
||||
log.Println("Warning, resizing!")
|
||||
left, top, right, bottom = gc.GetStringBounds(texts[longid])
|
||||
gc.SetFontSize(scale * (0.8 - 0.1*float64(iter)))
|
||||
width = right - left
|
||||
iter++
|
||||
}
|
||||
}
|
||||
|
||||
height := bottom - top
|
||||
margin := float64(10)
|
||||
margin := float64(height / 50)
|
||||
lines := float64(len(texts) - 1)
|
||||
|
||||
gc.Save()
|
||||
|
@ -146,7 +147,7 @@ func memegen(broker *tg.Broker, update tg.APIMessage) {
|
|||
|
||||
y := float64(0)
|
||||
if istop {
|
||||
y = (height-margin)*float64(id+1) + margin*5
|
||||
y = (height+margin)*float64(id+1) + margin*5
|
||||
} else {
|
||||
y = iheight - (height * lines) + (height * float64(id)) - margin*5
|
||||
}
|
||||
|
|
Reference in a new issue