抽取好奇猫中的图片上传与裁剪功能,创建一个单独的展示 demo,同时也对代码做了一些修改。
- Rails 4.1.6
- Carrierwave 0.10.0
- MiniMagick 3.7.0
- Jcrop
- Colorbox
- jQuery File Upload
upload and crop a image
现在的弹出框很小,不能显示整个图片。需要研究一下其用法,让弹出框美观些
看看这个 Gem 能不能用,不行就直接下载 Jcrop 的源码
现在点击文件上传按钮,图片就直接提交了,然后从服务器端得到图片地址,显示图片。
应该在图片上传到服务器之前,实现图片预览功能。
通过 AJAX 方式更新上传的图片,若新上传的图片与旧图片的名字一样,那么已在当前页面中的旧图片不能替换为新图片,刷新页面后,新图片才能显示。
看看这个 Gem 能不能用,不行就直接下载 Jcrop 的源码
去掉 “no file chosen” 字样
若上传文件采用随机名,且更新文件时用到 recreate_versions 方法,会重新生成文件名,
但文件内容不更新,仍然是原来的文件。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.