michaelfrank/dynamicphoto
Composer 安装命令:
composer require michaelfrank/dynamicphoto
包简介
Dynamic photo package for blog posts and other features, integrating CKEditor Smart WYSIWYG
README 文档
README
Dynamic Photo is a package to assist in integration with CKEditor, a powerful WYSIWYG. With the package it is possible to send photos dynamically to the server and display them.
✔️ Installing Dynamic Photo
❗️ Attention ❗️
this package is exclusive for Framework Laravel, So you will also need Composer.
composer require michaelfrank/dynamicphoto
...Then publish the provider package.
php artisan vendor:publish --tag=config
✔️ Instalando CDN CKEditor
In your VIEW in the script file, paste!
<script src="https://cdn.ckeditor.com/ckeditor5/16.0.0/classic/ckeditor.js"></script>
👇🏼 Now paste the code below
ClassicEditor.create( document.querySelector( '#editor' ), {
ckfinder: {
uploadUrl: '{{$siteRoot}}/api/uploud-photo',
}
} ).then( editor => {
console.log( 'Editor was initialized', editor );
myEditor = editor;
})
.catch( error => {
console.error( error.stack );
});
❗️ Attention ❗️
in uploadUrl, just modify your route url if you create a different route.
👇🏼 With that, just create a div with the id = "editor" that will be initialized!
<textarea name="" id="editor"></textarea>
Now you just need to create an Api route to send the image data that will be automatically displayed!
=======================
✔️ Creating controller and API route.
You now need to create your API route. Paste this code in your "api" file.
Route::post('/uploud-photo', 'APIs\UploudImages@uploud');
👇🏼 With the route created, run the command below to create the Controller.
php artisan make:controller APIs/UploudImages
Navigate to the created APIs / UploudImages.php file, Open the file.
Now just instantiate the class.
use michaelFrank\dynamicphoto\config\CkeditorUploud;
✔️ How to use
Paste this function into your class.
public function uploud(Request $req){ $file = new CkeditorUploud(); $saved = $file->uploadAction($req, 'Album01'); return $saved; }
The uploadAction function expects two arguments. the first is the request file, ie the image. The second will wait for the path, where 'Album01' will be the path where you will save your image
========== Help me, any value will be great for my work. This is your way of thanking. Thanks!
michaelfrank/dynamicphoto 适用场景与选型建议
michaelfrank/dynamicphoto 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 359 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 michaelfrank/dynamicphoto 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 michaelfrank/dynamicphoto 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 359
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-23