gocontext "context"
"encoding/base64"
"fmt"
+ "image"
"io"
"net/http"
"net/url"
"strings"
"time"
+ _ "image/gif" // for processing gif images
+ _ "image/jpeg" // for processing jpeg images
+ _ "image/png" // for processing png images
+
activities_model "code.gitea.io/gitea/models/activities"
admin_model "code.gitea.io/gitea/models/admin"
asymkey_model "code.gitea.io/gitea/models/asymkey"
issue_service "code.gitea.io/gitea/services/issue"
"github.com/nektos/act/pkg/model"
+
+ _ "golang.org/x/image/bmp" // for processing bmp images
+ _ "golang.org/x/image/webp" // for processing webp images
)
const (
}
}
+ if fInfo.st.IsImage() && !fInfo.st.IsSvgImage() {
+ img, _, err := image.DecodeConfig(bytes.NewReader(buf))
+ if err == nil {
+ // There are Image formats go can't decode
+ // Instead of throwing an error in that case, we show the size only when we can decode
+ ctx.Data["ImageSize"] = fmt.Sprintf("%dx%dpx", img.Width, img.Height)
+ }
+ }
+
if ctx.Repo.CanEnableEditor(ctx, ctx.Doer) {
if lfsLock != nil && lfsLock.OwnerID != ctx.Doer.ID {
ctx.Data["CanDeleteFile"] = false