image_lib watermarking - view part |
[eluser]Casperlarsen94[/eluser]
I'm trying to learn the codeigniter image libary, and i can't find anything about the view part in watermarking an image. Controller Code: $config['source_image'] = 'http://websplus.dk/images/layout/banner.png'; How should my view look like? ![]() I hope you guys can help me ![]() And happy new year ![]()
[eluser]Cristian Gilè[/eluser]
Hi Casperlarsen94, in the view something like this: Code: <img src='path/to/your/watermarked/image' alt='my watermarked image' /> Cristian Gilè
[eluser]Casperlarsen94[/eluser]
Is it possible to add my watermark to ONE image depending on the URL? For example, if the url www.example.com/banner/casperlarsen then the watermark text should be casperlarsen. Or if the url is www.example.com/banner/johndoe the text should be johndoe
[eluser]Nick_MyShuitings[/eluser]
Since you are adding the watermark text in the controller... and since the controller has access to the name.... connect the dots and it should be possible
[eluser]Cristian Gilè[/eluser]
Code: $config['source_image'] = 'http://websplus.dk/images/layout/banner.png'; Cristian Gilè
[eluser]Casperlarsen94[/eluser]
I know how to get the name from URL in to a string. But i don't know how to pass there config and the watermark information to my view, and then create the image?
[eluser]Cristian Gilè[/eluser]
The path of the image (source_image) must be a relative or absolute server path, not a URL. Cristian Gilè
[eluser]Casperlarsen94[/eluser]
But how schould the view look like? I don't understand it, sorry.
[eluser]Cristian Gilè[/eluser]
You have an image on your server and you have set its path in $config['source_image']. When you do Code: $this->image_lib->watermark(); the image has been watermarked. In your view, now, you can show the image with the img tag: Code: <img src='path/to/your/image' alt='my watermark image' /> If you need to restrict access to your images, read this Cristian Gilè
[eluser]Casperlarsen94[/eluser]
This doesn't works? My Controller Code: class Test extends Controller My View Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
Welcome Guest, Not a member yet? Register Sign In |