Jump to content

a bit of guidance


phppup

Recommended Posts

It's always these seemingly simple tasks that become challenges.

I got a good handle on how to watermark some photos (thanks to respondents to my previous post) and developed a script that calls a function that uses imagettftext()

Essentially, I can upload multiple images and watermark them before they reach their destination folder.

Good stuff.

Now, I got this crazy idea of watermarking them with a sequence number, so that if I grab 12 images, each will be labeled with it's sequence number (rather than a standard text watermark).

I placed $count++ in my script, and then used $count as my $watermark both inside imagettftext and as a variable.

It didn't work.

The closest I got was after placing $count++ inside a watermark function, but. of course, that merely labeled each photo with a "1" (bc each call of the function was a new iteration. 

Can someone please offer some direction here.

Thanks.

 

Link to comment
Share on other sites

Yes, yes, the code.

But first, I'd like to try to resolve this with some education. (especial since I've managed to get the basics of the code working). And I'm wondering if I may be creating my web of complications unnecessarily.

So here's a question (that may unravel some mystery and resolve my issues): are there a set of BEST PRACTICES for handling images?

After I have uploaded several images, I want to resize and watermark them.

At first, my thought process was to create separate functions and call them accordingly

upload(); resize ();  watermark ();

Then I wondered whether I was creating unnecessary redundancy and server load. Am I grabbing the image and writing it to my /images_folder and then grabbing it again to resize and overwrite it, then re-grabbing it and watermarking it and re-overwriting it again?  Is that creating workload?

Is it better to nest the watermarking function within the resizing for a more streamlined flow? Or does that create impracticalities of it's own?

Link to comment
Share on other sites

I would upload the images and resize them to a separate folder and use THOSE for my web page.  Perhaps a click response on a reduced one could take the user to the full size one on a separate page?

This eliminates the need to repeatedly re-size images for every user.

Link to comment
Share on other sites

7 hours ago, phppup said:

Is it better to nest the watermarking function within the resizing for a more streamlined flow? Or does that create impracticalities of it's own?

It all depends on your requirements.

  • Do you ever have a requirement for a reduced-size version that does not have a watermark?
  • Do you want to store the original full-size image with or without the watermark? Note that as soon as you manipulate the uploaded image you lose any exif data (such as rotation).
  • Do you require different sizes of images (thumbnail for product listings and medium when viewing individual product, say)?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.