Skip to content

PHP 8.4 compatibility, media library updates, and bug fixes#16

Merged
ahnv merged 14 commits intomasterfrom
IK-2447_IK-2457
Feb 26, 2026
Merged

PHP 8.4 compatibility, media library updates, and bug fixes#16
ahnv merged 14 commits intomasterfrom
IK-2447_IK-2457

Conversation

@ahnv
Copy link
Member

@ahnv ahnv commented Feb 19, 2026

Summary

This PR addresses PHP 8.4 compatibility issues, fixes image path handling to prevent duplicate catalog/product prefixes, updates the media library widget from 1.0.4 to 2.4.1, adds a dev container for local Magento 2.4 development, and fixes MP4 video insertion into product galleries.

Changes

  • 9a2364f - chore: added dev container setup for Magento 2.4
  • 7e66c04 - fix: normalized image path handling to prevent duplicate catalog/product prefixes
  • 4ff6041 - fix: resolve PHP 8.4 deprecation warnings in Upload controller
  • f0a96c2 - chore: updated imagekit-media-library-widget to 2.4.1
  • 0881958 - fix: MP4 video insertion into product gallery

Details

PHP 8.4 Deprecation Fix (Resolves #13)

  • Uses explicit nullable type (?DirectoryResolver) for optional $directoryResolver parameter
  • Reorders constructor parameters to place optional parameter after required ones
  • Fixes deprecation warnings when running bin/magento setup:di:compile on Magento 2.4.8 with PHP 8.4

Image Path Handling (Resolves IK-2457)

  • Normalized image path handling to prevent duplicate catalog/product prefixes
  • Fixed in UrlBuilder.php, ImageFactory.php, and Image.php plugins

Dependencies (Resolves #14)

  • Updated imagekit-media-library-widget from 1.0.4 to 2.4.1

MP4 Video Insertion Fix (Resolves #15)

  • New ImportVideo controller - Handles video file imports from ImageKit
    • Downloads video thumbnails with retry logic (5 attempts, 3s delay)
    • Returns proper external-video media type with video_provider: imagekit
    • Stores video metadata (URL, title) for gallery playback
  • Frontend video support - HTML5 video player with Fotorama gallery integration
  • Gallery plugin update - Injects video provider into gallery JSON data

Dev Container

  • Added complete dev container setup for local Magento 2.4 development
  • Streamlined installation and bootstrap scripts

ahnv added 11 commits February 19, 2026 20:51
- Use explicit nullable type for $directoryResolver parameter
- Reorder constructor parameters to place optional parameter after required ones

Fixes deprecation warnings on Magento 2.4.8 with PHP 8.4.

Resolves #13
…ount module as volume

- Install Magento during Docker build instead of bootstrap script
- Mount module source as volume at app/code/ImageKit/ImageKitMagento
- Add Node.js 20 via nvm for frontend tooling
- Update all script paths to new module location
- Add script to set admin session timeout to 1 year
- Simplify install-module.sh by removing rsync logic
- Fix admin password default and improve permission handling
- Add ImportVideo controller to handle video imports with thumbnail generation
- Implement retry logic for thumbnail retrieval with 202 status handling
- Add getVideoImporterUrl method to Gallery Content block
- Store video-thumbnail mappings in library_map table
- Support video files in WYSIWYG upload controller
- Update ImageKitImageProvider to handle full URLs for video thumbnails
- Add video metadata to gallery JSON (provider, URL
- Remove trailing comma in Upload.php constructor (PHP 7.4 compatibility)
- Replace @parse_url with parse_url in ImportVideo.php (error silencing)
- Switch to extdn/github-actions-m2/magento-phpstan/8.2@master for Composer 2 support
- Update PHPCS job to PHP 8.2 with shivammathur/setup-php@2.36.0
- Remove composer self-update workaround (no longer needed with 8.2 image)
@ahnv ahnv changed the title WIP: PHP 8.4 compatibility, media library updates, and bug fixes PHP 8.4 compatibility, media library updates, and bug fixes Feb 25, 2026
@imagekit-developer imagekit-developer deleted a comment from Copilot AI Feb 25, 2026
@ahnv ahnv requested a review from Copilot February 25, 2026 20:27
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ImageKit Magento extension to support PHP 8.4, MP4 video insertion into product galleries, and fixes image path handling to prevent duplicate catalog/product prefixes. It also updates the media library widget to version 2.4.1 and introduces a complete dev container setup for local Magento 2.4 development.

Changes:

  • Fixed PHP 8.4 deprecation warnings by reordering constructor parameters and using explicit nullable types
  • Normalized image path handling across three plugin files to prevent duplicate catalog/product prefixes
  • Added MP4 video support with a new ImportVideo controller, frontend HTML5 player, and gallery plugin updates
  • Updated imagekit-media-library-widget dependency from 1.0.4 to 2.4.1
  • Added comprehensive dev container setup with Dockerfile, docker-compose, and bootstrap scripts

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Controller/Adminhtml/Cms/Wysiwyg/Images/Upload.php Reordered constructor parameters to fix PHP 8.4 deprecation; added video file type handling
Controller/Adminhtml/Ajax/ImportVideo.php New controller for importing MP4 videos from ImageKit with thumbnail download and retry logic
Core/ImageKitImageProvider.php Refactored image path resolution into separate method; added support for absolute URLs
Plugin/Helper/Image.php Normalized image paths to prevent duplicate catalog/product prefixes
Plugin/Catalog/Model/Product/Image/UrlBuilder.php Normalized image paths to prevent duplicate catalog/product prefixes
Plugin/Catalog/Block/Product/ImageFactory.php Normalized image paths to prevent duplicate catalog/product prefixes
Plugin/AddImagesToGalleryBlock.php Added videoProvider injection into gallery JSON data
view/frontend/web/js/video-html5.js HTML5 video player widget for ImageKit videos with iframe/srcdoc support
view/frontend/web/js/fotorama-add-video-events-mixin.js Mixin to handle ImageKit video provider in Fotorama gallery
view/frontend/requirejs-config.js RequireJS configuration for video modules
view/adminhtml/web/js/panel.js Updated to use media library widget 2.4.1; added video importer URL routing
view/adminhtml/requirejs-config.js Updated media library widget CDN version to 2.4.1
Block/Adminhtml/Product/Helper/Form/Gallery/Content.php Added getVideoImporterUrl method
etc/adminhtml/di.xml Added video file extension configuration for CMS storage
etc/db_schema.xml Added asset_type column to library map table
etc/csp_whitelist.xml Added media-src policy for ImageKit domains
.devcontainer/* Complete dev container setup for local Magento 2.4 development
.github/workflows/ci.yml Updated GitHub Actions to use PHP 8.2 and latest action versions
Comments suppressed due to low confidence (5)

view/adminhtml/web/js/panel.js:8

  • Trailing comma in function parameter list should be removed.
], function (Element, $, ikMLWidget, uiAlert, notification, $t,) {

view/adminhtml/web/js/panel.js:11

  • Missing semicolon at the end of the statement.
  const IKMediaLibraryWidget = ikMLWidget.ImagekitMediaLibraryWidget

view/adminhtml/web/js/panel.js:48

  • The video file extension check duplicates logic found in the Upload.php controller. Consider extracting this to a shared configuration or constant to maintain consistency across frontend and backend validation.
                var isVideo = data.fileType && data.fileType !== 'image' &&
                    /\.(mp4|webm|ogv|mov)$/i.test(data.name);

Controller/Adminhtml/Ajax/ImportVideo.php:213

  • Method name 'retrieveRemoteImage' is misleading since this method is used to download video thumbnails, not images. Consider renaming to 'retrieveRemoteThumbnail' or 'downloadVideoThumbnail'.
    protected function retrieveRemoteImage($fileUrl, $localFilePath, $maxRetries = 5, $retryDelaySec = 3)

.github/workflows/ci.yml:26

  • Using wildcard version constraint (*) for magento-coding-standard can lead to unpredictable behavior. Consider pinning to a specific version range (e.g., ^35) for consistent CI builds.
          composer global require magento/magento-coding-standard:*

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ahnv added 3 commits February 26, 2026 11:43
…ix JS linting issues

- Rename retrieveRemoteImage method to retrieveRemoteThumbnail for clarity
- Remove trailing comma in panel.js function parameters
- Add missing semicolon after IKMediaLibraryWidget constant declaration
@ahnv ahnv merged commit 8d7d534 into master Feb 26, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants