ref(mixedimage): crop stack refactor and docs (#31) - #44
Open
Ibochkarev wants to merge 2 commits into
Open
Conversation
Restructure crop processor and manager JS without UX changes. Add README crop docs, Keep a Changelog format, and lexicon updates. Fix MIME/extension alignment and crop window lifecycle bugs. Refs webinmd#31
Ibochkarev
marked this pull request as ready for review
August 9, 2026 03:58
Use result.message from MODX response, add HTTP_MODAUTH, coerce crop dimensions to integers, and hide crop window only after successful save.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Закрывает #31: рефакторинг crop-стека и актуализация документации. UX в менеджере MODX не меняется.
Зачем
Crop работал, но код накапливал хрупкие места:
explodeпо точке в имени файла,toBlob()без MIME (PNG на диске при расширении.jpg), строковый парсингcrop_options, повторное открытие окна crop с устаревшим<img src>. README не описывал crop, triggerlist и событиеOnMixedImageCrop. Changelog шёл в старом формате с разделителями----.Что сделано
Processor (
crop.class.php)explode.pathinfo: корректные пути с несколькими точками (photo.name.jpg).time()→_timestamp, без повторного добавления, если суффикс уже в basename.$this->failure()и lexicon keys.$this->success($relativePath), клиент читаетresult.message.JS (
mixedimage.js)mixedimage:parseCropOptions,getSourceMime,buildCropperOptions,saveCroppedBlob.crop_options: coerciontrue/false/null/ числа вместо строк.toBlob(callback, mime)с MIME исходника (jpg остаётся jpg).showобновляется src и пересоздаётся Cropper. Наhide— destroy.windowCrop(windowCrop.superclassвместоwindow.superclass).HTTP_MODAUTHв crop-запросе, размеры crop черезparseInt, окно закрывается только после успешного save.Lexicon (ru/en)
crop_options: форматkey: value, автоматический разбор типов.triggerlist_descдополнен триггеромcrop.Docs
OnMixedImageCropс примером watermark, MIGX, системные настройки.[Unreleased].UX-контракт (без изменений)
crop, окно CropperJS, кнопки Crop / Cancel.crop_ratio,crop_width,crop_height,crop_suffix,crop_options.OnMixedImageCropсimage(absolute path) иtvId.Scope
Ветка содержит только изменения для #31. Не затрагивает remove/upload (#17) и preview reload (#35). После merge других PR возможны конфликты в
mixedimage.js.На ревью
toBlobи расширения в processor.time(), повторный crop.Fixes #31