Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:42:00+00:00 2026-06-16T05:42:00+00:00

I will get to the point. I have installed Watermark using htaccess. Everything is

  • 0

I will get to the point. I have installed Watermark using htaccess. Everything is working but I have no idea on how to make script NOT to place watermark on images smaller than 200×200. Also watermark is displaying a grayish line on the bottom where watermark.png sopose to be. How do I remove that line?

I oppologise for showing no effort. i did research for 4 hours and modify it so bad that my pictures was ruined. I found the line to add to php to not place watermark on small images, but do not know where to place it.

Here is the .php that places the watermark on image. Please help Is it is way to complicated for me.

<?php
$basedir="/uploads/";
$watermarkimage="tbwm.png";

$file=basename($_GET['i' ]);

$image = $basedir."/".$file;
$watermark = $basedir."/".$watermarkimage;

$im = imagecreatefrompng($watermark);

$ext = substr($image, -3);

if (strtolower($ext) == "gif") {
if (!$im2 = imagecreatefromgif($image)) {
echo "Error opening $image!"; exit;
}
} else if(strtolower($ext) == "jpg") {
if (!$im2 = imagecreatefromjpeg($image)) {
echo "Error opening $image!"; exit;
}
} else if(strtolower($ext) == "png") {
if (!$im2 = imagecreatefrompng($image)) {
echo "Error opening $image!"; exit;
}
} else {
die;
}
imagefilledrectangle($im2, 0  , (imagesy($im2))-(imagesy($im)) , imagesx($im2)  , imagesy($im2) , imagecolorallocatealpha($im2, 0, 0, 0, 100) );
imagecopy($im2, $im, (imagesx($im2)-(imagesx($im))), (imagesy($im2))-(imagesy($im)), 0, 0, imagesx($im), imagesy($im));

$last_modified = gmdate('D, d M Y H:i:s T' , filemtime ($image));

header("Last-Modified: $last_modified");
header("Content-Type: image/jpeg");
imagejpeg($im2,NULL,95);
imagedestroy($im);
imagedestroy($im2);

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:42:02+00:00Added an answer on June 16, 2026 at 5:42 am

    fast way:
    just put the imagecopy function call into the if(imagesx(im2) > 250 && imagesy(im2) > 250)

    if (imagesx($im2) > 250 && imagesy($im2) > 250) {
        imagefilledrectangle($im2, 0  , (imagesy($im2))-(imagesy($im)) , imagesx($im2)  , imagesy($im2) , imagecolorallocatealpha($im2, 0, 0, 0, 100));
        imagecopy($im2, $im, (imagesx($im2)-(imagesx($im))), (imagesy($im2))-(imagesy($im)), 0, 0, imagesx($im), imagesy($im));
    }
    

    long way:
    put everything created for the watermark im inside the if

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that will get images from page, but how do I
Right now I have a script that will get the last five files in
By using document.referrer we will get all the reference of URL in JavaScript, such
Here is the query which will get me all the contacts have HD quality
I have installed lion and afterwards I installed Xcode. But I have no IOS
I have successfully installed FOSUserBundle in my project and everything works as expected. However,
If I do: print The item is: + str(1) + . I will get:
I will get the error below randomly when I'm running an asp.net application I
This code will get us all the properties of a class: Dim myPropertyInfo As
I know i will get this exception when i try to modify or remove

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.