PHP - Generate transparency (or opacity) gradient using image

荒凉一梦 提交于 2019-12-25 01:27:03

问题


Using PHP is it possible to take an existing image and produce a copy where the original image changes from 100% opaque to 0% opaque (or 0% transparent to 100% transparent!)?

Thanks,

Toby

EDIT: I realise my question was unclear, apologies. I want to take an image and create an opacity gradient across it, so the image is 100% opaque at the top, 100% transparent at the bottom and translucent in between.


回答1:


If you change from 100% opaque to 0% opaque the image wouldn't be visible anymore. What do you want to do exactly? Change The whole Image or only a part? I would consider of using CSS (maybe + javascript) where you are able to set the transparency between 0% and 100%.




回答2:


Well if you take an image from 100% to 0%, it disappears right ? and 0% to 100% means it was transparent so it went black? I'm not sure exactly what you are asking bu try this tutorial



来源:https://stackoverflow.com/questions/4136152/php-generate-transparency-or-opacity-gradient-using-image

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!