John Davidson

html - Add 'Watermark' to images with php _code

0 comments
Message:


I have a website where users may upload images...


I need to add my logo (watermark) to the images every single time to uploaded.


How can I do so?


Anybody have a good tutorial, article or example for this? Or know of any function in php which I would need to find the position of the watermark?


<?php
if(houzez_edit_property()) {
$property_images = get_post_meta( $property_data->ID, 'fave_property_images', false );

$featured_image_id = get_post_thumbnail_id( $property_data->ID );
$property_images[] = $featured_image_id;
$property_images = array_unique($property_images);

if (!empty($property_images[0])) {
foreach ($property_images as $prop_image_id) {
$is_featured_image = ($featured_image_id == $prop_image_id);
$featured_icon = ($is_featured_image) ? 'text-success' : '';

$img_available = wp_get_attachment_image($prop_image_id, 'thumbnail');

if (!empty($img_available)) {
echo '<div class="col-md-3 col-sm-4 col-6 property-thumb">';
echo wp_get_attachment_image($prop_image_id, 'houzez-item-image-1', false, array('class' => 'img-fluid'));
echo '<div class="upload-gallery-thumb-buttons">';
echo '<button class="icon icon-fav icon-featured" data-property-id="' . intval($property_data->ID) . '" data-attachment-id="' . intval($prop_image_id) . '"><i class="houzez-icon icon-rating-star full-star '.esc_attr($featured_icon).'"></i></button>';

echo '<button class="icon icon-delete" data-property-id="' . intval($property_data->ID) . '" data-attachment-id="' . intval($prop_image_id) . '"><span class="btn-loader houzez-loader-js"></span><i class="houzez-icon icon-remove-circle"></i></button>';
echo '</div>';

echo '<input type="hidden" class="propperty-image-id" name="propperty_image_ids[]" value="' . intval($prop_image_id) . '"/>';

if ($is_featured_image) {
echo '<input type="hidden" class="featured_image_id" name="featured_image_id" value="' . intval($prop_image_id) . '">';
}

echo '</div>';
}
}
}
}
?>


My Answer:



My Webpage


Welcome to my webpage!


This is a paragraph of text on my webpage.



Rate this post

3 of 5 based on 1695 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us