{"data":{"id":"magento2-40388","source":"github-pr","sourceRef":"magento/magento2#40388","title":"Improve performance when resized image URL is accessed but does not yet exist.","pr":{"number":40388,"url":"https://github.com/magento/magento2/pull/40388","author":"rogerdz","mergedAt":"2026-07-06T10:04:37Z","mergeCommit":"aacb26f003496eb8a7a816f062467f46e3ff8acc","headCommit":"0436e467895eba23d310c3c4cee0594e17137d95","baseRef":"2.4-develop","diffSha256":"062c90f1e9e5cfe99e27edc47c6a3d5f8292b14c9cd3e1bef33f3ec20fc94d3d"},"issues":[{"number":40399,"url":"https://github.com/magento/magento2/issues/40399","title":"[Issue] Improve performance when resized image URL is accessed but does not yet exist.","labels":["Area: Content / CMS","Component: Image","Issue: Confirmed","Priority: P2","Progress: PR Created","Progress: done","Reported on 2.4.x","Reproduced on 2.4.x"],"kind":"pr-derived"}],"fixedIn":null,"containingTags":[],"reportedOn":null,"codeMatch":{"2.4.6":"conflict","2.4.6-p1":"conflict","2.4.6-p2":"conflict","2.4.6-p3":"conflict","2.4.6-p4":"conflict","2.4.6-p5":"conflict","2.4.6-p6":"conflict","2.4.6-p7":"conflict","2.4.6-p8":"conflict","2.4.6-p9":"conflict","2.4.6-p10":"conflict","2.4.6-p11":"conflict","2.4.6-p12":"conflict","2.4.6-p13":"conflict","2.4.6-p14":"conflict","2.4.6-p15":"conflict","2.4.7":"conflict","2.4.7-p1":"conflict","2.4.7-p2":"conflict","2.4.7-p3":"conflict","2.4.7-p4":"conflict","2.4.7-p5":"conflict","2.4.7-p6":"conflict","2.4.7-p7":"conflict","2.4.7-p8":"conflict","2.4.7-p9":"conflict","2.4.7-p10":"conflict","2.4.8":"conflict","2.4.8-p1":"conflict","2.4.8-p2":"conflict","2.4.8-p3":"conflict","2.4.8-p4":"conflict","2.4.8-p5":"conflict","2.4.9":"clean"},"affectedVersions":["2.4.9"],"components":["magento/module-media-storage"],"files":[{"path":"app/code/Magento/MediaStorage/App/Media.php","change":"modified","package":"magento/module-media-storage"},{"path":"app/code/Magento/MediaStorage/Service/ImageResize.php","change":"modified","package":"magento/module-media-storage"}],"stripped":{"tests":["app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php"],"docs":[],"outsideCode":[]},"linesChanged":77,"mergeBatched":false,"excluded":null,"sections":{"description":"Default Magento generate resize image for all image id (example:product_base_image , product_swatch_image_large, product_page_more_views, ...)  when resized image URL is accessed but does not yet exist.\nThis increases response time and disk I/O.\nTest with PR when accessing one missing resized image URL, response time decreased from 1s to 150ms","stepsToReproduce":"1. Remove all product resize image: rm -rf pub/media/catalog/product/cache/*\n2. Go to any resize image (example: https://magento2.test/media/catalog/product/cache/2765542505660baab28ecd555e27366e/w/t/wt09-white_main_2.jpg)\n3. Find all resize image (example: find pub/media/catalog/product/cache/ -type f -name '*wt09-white_main_2.jpg')\n4. Should create only resize image with hash 2765542505660baab28ecd555e27366e","expectedResult":null,"actualResult":null,"source":"pr"},"signatures":[],"labels":{"area":["Content / CMS"],"component":["Image"],"priority":"P2","severity":null,"reportedOn":["2.4.x"]},"categories":["Content"],"triage":{"model":"@cf/cloudflare/clef","requestHash":"062b3ec0be4bfc99dd0068c3a302ce08fc3617e40ba1218724228556ac90ecfb","isBugfix":0.1053,"changeKind":{"choice":"refactor","probabilities":{"bugfix":0.3681,"feature":0.1062,"refactor":0.4797,"tests_only":0.0297,"docs_only":0.0075,"dependency":0.0088},"confidence":0.2535},"scope":{"score":1.084,"probabilities":{"0":0.2268,"1":0.4624,"2":0.3108},"confidence":0.0428},"risk":{"score":0.5921,"probabilities":{"0":0.4457,"1":0.5166,"2":0.0377},"confidence":0.2004},"area":{"choice":"framework","probabilities":{"catalog":0.2506,"checkout":0.0075,"customer":0.0063,"admin":0.0203,"graphql_api":0.0081,"framework":0.2824,"frontend":0.1553,"other":0.2695},"confidence":0.1313},"securityRelevant":0.0083,"reportedVersion":{"choice":"unspecified","probabilities":{"2.4.0":0.0045,"2.4.0-p1":0.0041,"2.4.1":0.0036,"2.4.1-p1":0.0033,"2.4.2":0.0053,"2.4.2-p1":0.006,"2.4.2-p2":0.0065,"2.4.3":0.0096,"2.4.3-p1":0.0102,"2.4.3-p2":0.0092,"2.4.3-p3":0.0055,"2.4.4":0.0156,"2.4.4-p1":0.0087,"2.4.4-p10":0.0072,"2.4.4-p11":0.0076,"2.4.4-p12":0.0064,"2.4.4-p13":0.0057,"2.4.4-p14":0.0075,"2.4.4-p15":0.0051,"2.4.4-p16":0.0061,"2.4.4-p17":0.0052,"2.4.4-p18":0.0043,"2.4.4-p2":0.0025,"2.4.4-p3":0.0028,"2.4.4-p4":0.0026,"2.4.4-p5":0.0031,"2.4.4-p6":0.0039,"2.4.4-p7":0.0039,"2.4.4-p8":0.0048,"2.4.4-p9":0.0036,"2.4.5":0.0195,"2.4.5-p1":0.0127,"2.4.5-p10":0.0082,"2.4.5-p11":0.0124,"2.4.5-p12":0.0114,"2.4.5-p13":0.0088,"2.4.5-p14":0.0092,"2.4.5-p15":0.0085,"2.4.5-p16":0.009,"2.4.5-p17":0.0089,"2.4.5-p2":0.0032,"2.4.5-p3":0.0055,"2.4.5-p4":0.0051,"2.4.5-p5":0.0065,"2.4.5-p6":0.0064,"2.4.5-p7":0.0074,"2.4.5-p8":0.0059,"2.4.5-p9":0.0059,"2.4.6":0.0368,"2.4.6-p1":0.0249,"2.4.6-p10":0.0139,"2.4.6-p11":0.0143,"2.4.6-p12":0.0131,"2.4.6-p13":0.0119,"2.4.6-p14":0.0105,"2.4.6-p15":0.0089,"2.4.6-p2":0.0046,"2.4.6-p3":0.0089,"2.4.6-p4":0.0101,"2.4.6-p5":0.0075,"2.4.6-p6":0.0116,"2.4.6-p7":0.008,"2.4.6-p8":0.0069,"2.4.6-p9":0.0073,"2.4.7":0.0186,"2.4.7-p1":0.0142,"2.4.7-p10":0.0099,"2.4.7-p2":0.0078,"2.4.7-p3":0.015,"2.4.7-p4":0.0149,"2.4.7-p5":0.0116,"2.4.7-p6":0.0145,"2.4.7-p7":0.0117,"2.4.7-p8":0.0106,"2.4.7-p9":0.007,"2.4.8":0.021,"2.4.8-p1":0.0193,"2.4.8-p2":0.0202,"2.4.8-p3":0.0181,"2.4.8-p4":0.0169,"2.4.8-p5":0.017,"2.4.9":0.02,"unspecified":0.2036},"confidence":0.0404},"backportWorthy":{"score":1.238,"probabilities":{"0":0.2016,"1":0.3589,"2":0.4395},"confidence":0.0439}},"curated":{"title":"Generates only the requested resized image when a missing cache URL is opened","description":"When a resized image URL is accessed but does not yet exist, Magento will generate resize images for all image id, such as product_base_image and product_swatch_image_large. This increases response time and disk I/O. With the hash media URL format, Media.php now calls resizeFromImageName() in ImageResize.php with relativeFileName, so it will create only the resize image for that cache file.","categories":["Content"],"author":"claude-code/opus-5.5","date":"2026-10-06","reviewedBy":null},"tests":{"2.4.9":{"before":"fail","after":"pass","adapted":false,"runAt":"2026-10-06T09:20:16.059Z","releaseCommit":"755e34dd689021c5165db9d35ecff74f7dc51527","suites":{"unit":{"before":"fail","after":"pass","runAt":"2026-10-06T09:20:16.059Z"}}}}},"_documentation":"https://magento.watch/api","_description":"Upstream fix magento2-40388 details"}