SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Scaling and Watermarking
         Images




        www.prodigyview.com
Overview
Objective
Learn the how to create watermark on an image using text or
another image. Also learn how to scale images to different
sizes.
Requirements
 Understanding of Image Basics
 Installed version of Imagick
Estimated Time
10 minutes


                      www.prodigyview.com
Follow Along With A Code
                Example
1. Download a copy of the example code at
  www.prodigyview.com/source.

2. Install the system in an environment you feel comfortable
  testing in.

3. Proceed to examples/avi/ScaleandWatermarkImage.php




                       http://www.prodigyview.com
Scaling An Image
     To start this store we need an image to scale. First we are
     going to define our image and afterwards we are going to scale
     it too different sizes using PVImage::scaleImage.

1. Define the image and pass the 2. Set the new width   3. Set the new height
image location as an argument




     4. The location of the scaled image
Scaled Images
The scaled images should look something similar to
below. Both of these are much smaller than the original.




                     www.prodigyview.com
Scaling With Options
     Depending on the scenario, such as images stored as
     bytes in the database, you might receive the image a
     string in php. This is not a problem, we just set the type to
     blob.
1. Read the image in from a file as a string     2. Set the file option to ‘blob’
                                                 for images in blob/bytes/string
                                                 format




3. Use a defined image name instead of a random Do not add an extension to the
                                              4.
one                                           filename
Scaled With Options 2
  Now that we have our options set, we can scale the
  image from the bytes read from the file, and write it out to
  file.


1. Pass in the bytes string from the file          2. Set the width and height




                          3. Pass in the options
Watermark with Text
  Add we move on watermarking images. Watermarking
  with text is relatively simple. All we need is the image to
  watermark and a string of text.

1. Location of the image




                           2. Text to place as a watermark
Watermarked Image
Our watermarked image, without any modifications, will
look like below.
Text Watermarking with Options
   Our previous example of watermarking can be a little
   bland. With some options, we can add some style to the
   watermarks.

1. Read the image in as bytes     2. Change the font color       3. Rotate the text




 4. Offset the set        5. Set the name of the file    6. Use blob for byte input
Watermarked Image with Flavor
 Pass in the variables and we should get back our image
 with an altered text watermark.

1. Pass in the image bytes   2. Set the text   3. Pass in the options
Watermark with Image
Our final demonstration in this tutorial is watermarking with
another image. What the method
watermarkImageWithImage() really does is combine two
images together. In our example we use a smaller image of the
same image, but in production environment, it is suggested to a
very light image.
Two Images Combined
Below is how the images looked combine. Replace with
your own image and change the offset to customize the
watermark.
Review
1. Scale an image using the PVImage::scaleImage()
   method.

2. Watermark an image with text using the
   PVImage::watermarkImageWithText() method

3. Watermark/Combine two image with another image
   using PVImage::watermarkImageWithImage()
   method.




                    www.prodigyview.com
API Reference
For a better understanding of the image manipulation, check
out the api at the two links below.

PVImage




                  More Tutorials
 For more tutorials, please visit:

 http://www.prodigyview.com/tutorials


                        www.prodigyview.com

Weitere Àhnliche Inhalte

Mehr von ProdigyView

Mehr von ProdigyView (20)

Building An Application
Building An ApplicationBuilding An Application
Building An Application
 
Installing Applications
Installing ApplicationsInstalling Applications
Installing Applications
 
Video Content Management
Video Content ManagementVideo Content Management
Video Content Management
 
Audio Content Management
Audio Content ManagementAudio Content Management
Audio Content Management
 
File Content Management
File Content ManagementFile Content Management
File Content Management
 
Email Configuration
Email ConfigurationEmail Configuration
Email Configuration
 
HTML5 Tags and Elements Tutorial
HTML5 Tags and Elements TutorialHTML5 Tags and Elements Tutorial
HTML5 Tags and Elements Tutorial
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
 
Html Tags Tutorial
Html Tags TutorialHtml Tags Tutorial
Html Tags Tutorial
 
Video Conversion PHP
Video Conversion PHPVideo Conversion PHP
Video Conversion PHP
 
Sending Email Basics PHP
Sending Email Basics PHPSending Email Basics PHP
Sending Email Basics PHP
 
Tools ProdigyView
Tools ProdigyViewTools ProdigyView
Tools ProdigyView
 
Custom Validation PHP
Custom Validation PHPCustom Validation PHP
Custom Validation PHP
 
Basic File Cache Tutorial - PHP
Basic File Cache Tutorial - PHPBasic File Cache Tutorial - PHP
Basic File Cache Tutorial - PHP
 
Understanding Web Cache
Understanding Web CacheUnderstanding Web Cache
Understanding Web Cache
 
Javascript And CSS Libraries
Javascript And CSS LibrariesJavascript And CSS Libraries
Javascript And CSS Libraries
 
PHP Libraries
PHP LibrariesPHP Libraries
PHP Libraries
 
SQL Prepared Statements Tutorial
SQL Prepared Statements TutorialSQL Prepared Statements Tutorial
SQL Prepared Statements Tutorial
 
Database Basics
Database BasicsDatabase Basics
Database Basics
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design Pattern
 

KĂŒrzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂŒrzlich hochgeladen (20)

Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Navi Mumbai Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls đŸ„° 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls đŸ„° 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Scale and Watermark Images PHP

  • 1. Scaling and Watermarking Images www.prodigyview.com
  • 2. Overview Objective Learn the how to create watermark on an image using text or another image. Also learn how to scale images to different sizes. Requirements  Understanding of Image Basics  Installed version of Imagick Estimated Time 10 minutes www.prodigyview.com
  • 3. Follow Along With A Code Example 1. Download a copy of the example code at www.prodigyview.com/source. 2. Install the system in an environment you feel comfortable testing in. 3. Proceed to examples/avi/ScaleandWatermarkImage.php http://www.prodigyview.com
  • 4. Scaling An Image To start this store we need an image to scale. First we are going to define our image and afterwards we are going to scale it too different sizes using PVImage::scaleImage. 1. Define the image and pass the 2. Set the new width 3. Set the new height image location as an argument 4. The location of the scaled image
  • 5. Scaled Images The scaled images should look something similar to below. Both of these are much smaller than the original. www.prodigyview.com
  • 6. Scaling With Options Depending on the scenario, such as images stored as bytes in the database, you might receive the image a string in php. This is not a problem, we just set the type to blob. 1. Read the image in from a file as a string 2. Set the file option to ‘blob’ for images in blob/bytes/string format 3. Use a defined image name instead of a random Do not add an extension to the 4. one filename
  • 7. Scaled With Options 2 Now that we have our options set, we can scale the image from the bytes read from the file, and write it out to file. 1. Pass in the bytes string from the file 2. Set the width and height 3. Pass in the options
  • 8. Watermark with Text Add we move on watermarking images. Watermarking with text is relatively simple. All we need is the image to watermark and a string of text. 1. Location of the image 2. Text to place as a watermark
  • 9. Watermarked Image Our watermarked image, without any modifications, will look like below.
  • 10. Text Watermarking with Options Our previous example of watermarking can be a little bland. With some options, we can add some style to the watermarks. 1. Read the image in as bytes 2. Change the font color 3. Rotate the text 4. Offset the set 5. Set the name of the file 6. Use blob for byte input
  • 11. Watermarked Image with Flavor Pass in the variables and we should get back our image with an altered text watermark. 1. Pass in the image bytes 2. Set the text 3. Pass in the options
  • 12. Watermark with Image Our final demonstration in this tutorial is watermarking with another image. What the method watermarkImageWithImage() really does is combine two images together. In our example we use a smaller image of the same image, but in production environment, it is suggested to a very light image.
  • 13. Two Images Combined Below is how the images looked combine. Replace with your own image and change the offset to customize the watermark.
  • 14. Review 1. Scale an image using the PVImage::scaleImage() method. 2. Watermark an image with text using the PVImage::watermarkImageWithText() method 3. Watermark/Combine two image with another image using PVImage::watermarkImageWithImage() method. www.prodigyview.com
  • 15. API Reference For a better understanding of the image manipulation, check out the api at the two links below. PVImage More Tutorials For more tutorials, please visit: http://www.prodigyview.com/tutorials www.prodigyview.com