如何使用PHP和/或imagemagick检测图像是空白的(只有单个,任意颜色,或使用gif,随机任意颜色的帧)?
我想这就是我要尝试的:http: //www.php.net/manual/en/function.imagecolorat.php#97957
我正在构建一个 jQuery 插件,它为图像添加水印(是的,我很清楚 javascript/html5 水印系统的众多缺点,但现在暂时忽略它。)每个图像的基本方法是:
现在,如果我用画布本身替换图像元素,它似乎工作正常......所有元素都出现在画布上。但是当我获得画布的 dataURL 时,除了绘制在它上面的最后一个图像之外的所有内容都会出现。我什至不介意这个插件也需要替换图像的链接,因此用数据 url(带水印)替换 hrefs。
这是当前的代码:
(function($){
$.fn.extend({
cmark: function(options) {
var defaults = {
type: 'image',
content: 'watermark.png',
filter: 'darker',
scale:300,
box: {
top : 0.5,
left : 0.5,
width : 0.75,
height : 0.75,
bgcolor : '#000000',
bgopacity : 0.5,
fgopacity : 1
},
callback_unsupported: function(obj){
return obj;
}
}
var getScale = function(w, h, scale){
ratio = Math.min(scale/w, scale/h);
scalew = Math.round(ratio*w);
scaleh = Math.round(ratio*h);
return …Run Code Online (Sandbox Code Playgroud)