fix: drill card thumbnail aspect ratio, ice canvas syntax error, and logo loading #4

Open
crashmedia wants to merge 3 commits from fix/drill-thumbnail-and-logo into main
Owner

Summary

Fixes two reported issues: drill card thumbnails showing distorted ice surfaces, and the center ice logo not rendering (showing tiny fallback text instead).

Changes

Fix 1: js/ice_canvas.js — Syntax error in drawRinkBorder

Root cause: Invalid double-else block (} else { ... } else { ... }) caused a JavaScript parse error, preventing IceCanvasRenderer from being defined. This broke the drill designer and any view using the JS renderer.

Fix: Changed else if (half-ice-lengthwise) ... else { center } else { full } to proper else if (half-ice-lengthwise) ... else if (center) ... else { full } chain.

Fix 2: views/drills_library.php — Aspect ratio distortion in drill thumbnails

Root cause: ctx.drawImage(rinkImg, 0, 0, w, h) stretched the 200:85 aspect ratio rink image to fill the 3:2 canvas, distorting the ice surface.

Fix: Added object-fit: contain logic — calculates proper draw dimensions that maintain the rink's aspect ratio and centers it within the canvas.

Fix 3: generate_rink_images.php — Logo loading fails silently

Root cause: loadLogoImage() relied solely on file_get_contents() which may fail for RustFS URLs (disabled allow_url_fopen, network issues, etc.). When it fails, the fallback text "ARCTIC WOLVES HOCKEY" is drawn instead — which appears as tiny text when the 7680px image is scaled to thumbnails.

Fix: Added cURL as a fallback method when file_get_contents() fails.

Fix 4: js/ice_canvas.js — Logo opacity too low

Root cause: The center ice logo was drawn at 12% opacity (ctx.globalAlpha = 0.12), making it barely visible even when loaded successfully.

Fix: Increased logo image opacity to 25% while keeping fallback text at 12%.

Branch

fix/drill-thumbnail-and-logomain

After merge, rink images should be regenerated (php generate_rink_images.php?regenerate=1) to bake in the logo with the new loading method.

## Summary Fixes two reported issues: drill card thumbnails showing distorted ice surfaces, and the center ice logo not rendering (showing tiny fallback text instead). ## Changes ### Fix 1: `js/ice_canvas.js` — Syntax error in `drawRinkBorder` **Root cause:** Invalid double-`else` block (`} else { ... } else { ... }`) caused a JavaScript parse error, preventing `IceCanvasRenderer` from being defined. This broke the drill designer and any view using the JS renderer. **Fix:** Changed `else if (half-ice-lengthwise) ... else { center } else { full }` to proper `else if (half-ice-lengthwise) ... else if (center) ... else { full }` chain. ### Fix 2: `views/drills_library.php` — Aspect ratio distortion in drill thumbnails **Root cause:** `ctx.drawImage(rinkImg, 0, 0, w, h)` stretched the 200:85 aspect ratio rink image to fill the 3:2 canvas, distorting the ice surface. **Fix:** Added `object-fit: contain` logic — calculates proper draw dimensions that maintain the rink's aspect ratio and centers it within the canvas. ### Fix 3: `generate_rink_images.php` — Logo loading fails silently **Root cause:** `loadLogoImage()` relied solely on `file_get_contents()` which may fail for RustFS URLs (disabled `allow_url_fopen`, network issues, etc.). When it fails, the fallback text "ARCTIC WOLVES HOCKEY" is drawn instead — which appears as tiny text when the 7680px image is scaled to thumbnails. **Fix:** Added cURL as a fallback method when `file_get_contents()` fails. ### Fix 4: `js/ice_canvas.js` — Logo opacity too low **Root cause:** The center ice logo was drawn at 12% opacity (`ctx.globalAlpha = 0.12`), making it barely visible even when loaded successfully. **Fix:** Increased logo image opacity to 25% while keeping fallback text at 12%. ## Branch `fix/drill-thumbnail-and-logo` → `main` After merge, rink images should be regenerated (`php generate_rink_images.php?regenerate=1`) to bake in the logo with the new loading method.
This pull request has changes conflicting with the target branch.
  • generate_rink_images.php
  • js/ice_canvas.js
  • views/drills_library.php
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/drill-thumbnail-and-logo:fix/drill-thumbnail-and-logo
git switch fix/drill-thumbnail-and-logo

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fix/drill-thumbnail-and-logo
git switch fix/drill-thumbnail-and-logo
git rebase main
git switch main
git merge --ff-only fix/drill-thumbnail-and-logo
git switch fix/drill-thumbnail-and-logo
git rebase main
git switch main
git merge --no-ff fix/drill-thumbnail-and-logo
git switch main
git merge --squash fix/drill-thumbnail-and-logo
git switch main
git merge --ff-only fix/drill-thumbnail-and-logo
git switch main
git merge fix/drill-thumbnail-and-logo
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
crashmedia/Arctic-Wolves-Production!4
No description provided.