0

Hello,

I am planning on creating stock photos like 123rf.com. It's just a small feature on my web.

I wonder how to create a watermark with codes? Is that possible? We are selling photography photos.

Before the buyer purchase it - it must be watermarked. How?

Regards,
Davy

3
Contributors
6
Replies
35
Views
4 Months
Discussion Span
Last Post by Damhart
0

Quite an easy process. Just create a semitransparent watermark, find an image, add the watermark to your image and voila, you're done!

0

I finally find the upload image codes: https://www.sanwebe.com/2014/08/watermark-an-uploaded-image-with-php

Now, I would like to create a picture of watermarked gallery. (All of the pictures must be watermarked). Which codes should I use? (since the real pic is not water marked)

Is this good?

imagejpeg($pic1, NULL , 90);
imagejpeg($pic2, NULL , 90);
imagejpeg($pic3, NULL , 90);
imagejpeg($pic4, NULL , 90);

Or should I really print the picture with the watermarked?

0

I think I am making it complicated. Here my photo gallery codes (it's in laravel):

setting.blade.php

    <table>
                                        @foreach (collect($themes)->chunk(3) as $chunk)
                                            <tr>
                                            @foreach ($chunk as $theme)
                                                <td>
                                                    <img width="100px"
                                                        height="100px"
                                                        src="{{url('/')}}/uploads/theme/{{$theme->pic_name}}.jpg"/> 
                                                    <input type="checkbox"/>
                                                </td>
                                            @endforeach
                                            </tr>
                                        @endforeach
                                    </table>

HomeController.php

 public function getBackgroundTheme()
{

    $query = DB::table('theme_background');

    if (request()->has('menu')) {
        $theme = DB::table('kategori_name')->where('kategori_theme', request('menu'))->first();

        $query = $query->where('kategori_id', $theme->kategori_id);
    } 

    $model = $query->get();
    //$theme = $query->paginate(2);
    // dd(auth()->user());
    // dd(auth()->user());
    return view('soulfy.setting', [
        'themes'=>$model,
        'user' => auth()->user(),
    ]);

    // return redirect('/home/setting' . 
}

Let saya my watermark image is watermark.png . Now how to place this water mark image on top of all shown picture gallery?

1

For every image you want to store a separate watermarked version of that image. So, you need a 'task' that runs per upload. For your already-uploaded images you need to also be able to run that task.

In Rails, let's say you have a class called Image with method generate_watermark

class < ActiveRecord::Base

  after_save :generate_watermark, if: :image_changed?

  def generate_watermark
    ...
  end

end

So, this method is called every time the image is changed. Easy. Now, for your backlog you need to call this method for every Image that has no watermark. Fire up a Rails console:

Image
  .where(watermark: :nil)
  .each(&:generate_watermark)

Easy, huh? You'd use the same approach in Laravel.

Edited by pty

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.