Skip to content

Commit

Permalink
feat(resize): remove table name from asset path
Browse files Browse the repository at this point in the history
  • Loading branch information
catouberos committed Oct 14, 2024
1 parent aed6b43 commit 54ea1b6
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions hooks/resize_asset_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package hooks
import (
"database/sql"
"errors"
"fmt"
"path"

"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/core"
Expand Down Expand Up @@ -58,14 +58,9 @@ func resizeAssetImage(
if err != nil {
return err
}
path := fmt.Sprintf(
"%s/%s/%s",
asset.TableName(),
asset.Id,
asset.Image,
)
assetPath := path.Join(asset.Id, asset.Image)
asset.ResizedImage = types.JsonMap{}
resizedImages := getImageSizes(context.ImagorSecret, path)
resizedImages := getImageSizes(context.ImagorSecret, assetPath)
for id, resizedPath := range resizedImages {
asset.ResizedImage[id] = resizedPath
}
Expand Down

0 comments on commit 54ea1b6

Please sign in to comment.