


fck upload image to add watermark code modification_PHP tutorial
fck Upload pictures to add watermark code modification //We only need to find the editor/filemanger/conectors/php/commands.php file and replace the following php code with your commands.php file.
fck Upload image to add watermark code modification
//We only need to find the editor/filemanger/conectors/php tutorial/commands.php tutorial file and replace the following php code with your commands.php file.
function getfolders( $resourcetype, $currentfolder )
{
// map the virtual path to the local server path.
$sserverdir = servermapfolder( $resourcetype, $currentfolder, 'getfolders' ) ;
// array that will hold the folders names.
$afolders = array() ;
$ocurrentfolder = opendir( $sserverdir ) ;
while ( $ sfile = readdir( $ocurrentfolder ) )
{
if ( $sfile != '.' && $sfile != '..' && is_dir( $sserverdir . $sfile ) )
$afolders[] = '
}
closedir( $ocurrentfolder ) ;
// open the " folders" node.
echo "
natcasesort( $afolders ) ;
foreach ( $afolders as $sfolder )
echo $sfolder ;
// close the "folders" node.
echo "" ;
}
function getfoldersandfiles( $resourcetype, $currentfolder )
{
// map the virtual path to the local server path.
$sserverdir = servermapfolder( $resourcetype, $currentfolder, 'getfoldersandfiles' ) ;
// arrays that will hold the folders and files names.
$afolders = array() ;
$afiles = array() ;
$ocurrentfolder = opendir( $sserverdir ) ;
while ( $sfile = readdir( $ocurrentfolder ) )
{
if ( $sfile != '.' && $sfile != '..' )
{
if ( is_dir( $sserverdir . $sfile ) )
$afolders[] = '
else
{
$ifilesize = @filesize( $sserverdir . $sfile ) ;
if ( !$ifilesize ) {
$ifilesize = 0 ;
}
if ( $ifilesize > 0 )
{
$ifilesize = round( $ifilesize / 1024 ) ;
if ( $ifilesize < 1 ) $ifilesize = 1 ;
}
$afiles[] = '
}
}
}
// send the folders
natcasesort( $afolders ) ;
echo '< folders>' ;
foreach ( $afolders as $sfolder )
echo $sfolder ;
echo '' ;
// send the files
natcasesort( $afiles ) ;
echo '
foreach ( $afiles as $sfiles )
echo $sfiles ;
echo ' ' ;
}
function createfolder( $resourcetype, $currentfolder )
{
if (!isset($_get)) {
global $_get;
}
$serrornumber = '0' ;
$serrormsg = '' ;
if ( isset( $_get['newfoldername'] ) )
{
$ snewfoldername = $_get['newfoldername'] ;
$snewfoldername = sanitizefoldername( $snewfoldername ) ;
if ( strpos( $snewfoldername, '..' ) !== false )
$serrornumber = '102' ; // invalid folder name.
else
{
// map the virtual path to the local server path of the current folder.
$sserverdir = servermapfolder( $resourcetype, $ currentfolder, 'createfolder' );
switch ( $serrormsg )
{
case '' :
$serrornumber = '0' ;
break ;
case 'invalid argument' :
case 'no such file or directory' :
$serrornumber = '102' ; // path too long.
break ;
default :
$serrornumber = '110' ;
break ;
}
}
else
$serrornumber = '103' ;
}
}
else
$serrornumber = '102' ;
// create the "error" node.
echo '
}
function fileupload( $resourcetype, $currentfolder, $scommand )
{
if (!isset($_files)) {
global $_files;
}
$serrornumber = '0' ;
$sfilename = '' ;
if ( isset( $_files['newfile'] ) && !is_null( $_files['newfile']['tmp_name'] ) )
{
global $config ;
$ofile = $_files['newfile'] ;
// map the virtual path to the local server path.
$sserverdir = servermapfolder( $resourcetype, $currentfolder, $scommand ) ;
// get the uploaded file name.
$sfilename = $ofile['name'] ;
$sfilename = sanitizefilename( $sfilename ) ;
$soriginalfilename = $sfilename ;
// get the extension.
$sextension = substr( $sfilename, ( strrpos($sfilename, '.') + 1 ) ) ;
$sextension = strtolower( $sextension ) ;
if ( isset( $config['secureimageuploads'] ) )
{
if ( ( $isimagevalid = isimagevalid( $ofile['tmp_name'], $sextension ) ) === false )
{
$serrornumber = '202' ;
}
}
if ( isset( $config['htmlextensions'] ) )
{
if ( !ishtmlextension( $sextension, $config['htmlextensions'] ) &&
( $detecthtml = detecthtml( $ofile['tmp_name'] ) ) === true )
{
$serrornumber = '202' ;
}
}
// check if it is an allowed extension.
if ( !$serrornumber && isallowedext( $sextension, $resourcetype ) )
{
$icounter = 0 ;
while ( true )
{
$sfilepath = $sserverdir . $sfilename ;
//$sfilepath =$sserverdir.time().$sextension;
if ( is_file( $sfilepath ) )
{
$icounter++ ;
$sfilename = removeextension( $soriginalfilename ) . '(' . $icounter . ').' . $sextension ;
$serrornumber = '201' ;
}
else
{
move_uploaded_file( $ofile['tmp_name'], $sfilepath ) ;
if ( is_file( $sfilepath ) )
{
if ( isset( $config['chmodonupload'] ) && !$config['chmodonupload'] )
{
break ;
}
$permissions = 0777;
if ( isset( $config['chmodonupload'] ) && $config['chmodonupload'] )
{
$permissions = $config['chmodonupload'] ;
}
$oldumask = umask(0) ;
chmod( $sfilepath, $permissions ) ;
umask( $oldumask ) ;
}
break ;
}
}
//Add watermark
// add start
$waterimg="php100.com.png"; //Watermark image Modify the address of your watermark image here
if($watermark==1)
{
$image_size = getimagesize($sfilepath);
$iinfo=getimagesize($sfilepath,$iinfo);
$nimage=imagecreatetruecolor( $image_size[0],$image_size[1]);
$white=imagecolorallocate($nimage,255,255,255);
$black=imagecolorallocate($nimage,0,0,0);
$red =imagecolorallocate($nimage,255,0,0);
imagefill($nimage,0,0,$white);
switch ($iinfo[2])
{
case 1:
$simage =imagecreatefromgif($sfilepath);
break;
case 2:
$simage =imagecreatefromjpeg($sfilepath);
break;
case 3:
$ simage =imagecreatefrompng($sfilepath);
break;
// case 6:
// $simage =imagecreatefromwbmp($sfilepath);
// break;
default:
die("Unsupported file type");
exit;
}
imagecopy($nimage,$simage,0,0,0,0,$image_size[0],$image_size [1]);
switch($watertype)
{
case 1: // Watermark string
imagestring($nimage,2,3,$image_size[1]- 15,$waterstring,$black);
break;
case 2: //watermark image
$simage1 =imagecreatefrompng($waterimg);
imagecopy($nimage,$simage1,$image_size [0]/2,$image_size[0]/2,0,0,240,65);
imagedestroy($simage1);
break;
}
switch ($iinfo[ 2])
{
case 1:
imagegif($nimage, $sfilepath);
// imagejpeg($nimage, $sfilepath);
break;
case 2:
imagejpeg($nimage, $sfilepath);
break;
case 3:
imagepng($nimage, $sfilepath);
break;
// case 6:
// imagewbmp($nimage, $sfilepath);
//imagejpeg($nimage, $sfilepath);
// break;
}
//Overwrite the original upload File
imagedestroy($nimage);
imagedestroy($simage);
}
//Add watermark result
if ( file_exists( $sfilepath ) )
{
//previous checks failed, try once again
if ( isset( $isimagevalid ) && $isimagevalid === -1 && isimagevalid( $sfilepath, $sextension ) === false )
{
@unlink( $sfilepath ) ;
$serrornumber = '202' ;
}
else if ( isset( $detecthtml ) && $detecthtml === -1 && detecthtml( $sfilepath ) === true )
{
@unlink( $sfilepath ) ;
$serrornumber = '202' ;
}
}
}
else
$serrornumber = '202' ;
}
else
$serrornumber = '202' ;
$sfileurl = combinepaths( getresourcetypepath( $resourcetype, $scommand ) , $currentfolder ) ;
$sfileurl = combinepaths( $sfileurl, $sfilename ) ;
senduploadresults( $serrornumber, $sfileurl , $sfilename ) ;
exit ;
}?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

1. First open DingTalk. 2. Open the group chat and click the three dots in the upper right corner. 3. Find my nickname in this group. 4. Click to enter to modify and save.

With the continuous development of social media, Xiaohongshu has become a platform for more and more young people to share their lives and discover beautiful things. Many users are troubled by auto-save issues when posting images. So, how to solve this problem? 1. How to solve the problem of automatically saving pictures when publishing on Xiaohongshu? 1. Clear the cache First, we can try to clear the cache data of Xiaohongshu. The steps are as follows: (1) Open Xiaohongshu and click the "My" button in the lower right corner; (2) On the personal center page, find "Settings" and click it; (3) Scroll down and find the "Clear Cache" option. Click OK. After clearing the cache, re-enter Xiaohongshu and try to post pictures to see if the automatic saving problem is solved. 2. Update the Xiaohongshu version to ensure that your Xiaohongshu

Want to know how to add watermark to MeituXiuXiu? Meitu Xiuxiu is a very easy-to-use photo editing software. It provides functions such as cutting out pictures and placing them on another picture, changing the picture size by kb, removing watermarks, changing the background color of ID photos, and adding time, date and location watermarks to the full screen. Help users quickly complete the production of pictures. Some users have created their own pictures and don’t want others to steal them. They want to cover them with their own watermarks, but don’t know how to do it? The editor will now share with you how to add watermarks to beautiful photos! If you like it, come and download it! 1. How to add watermark to beautiful pictures? Share how to add watermark to beautiful photos! 1. Open the 2023 version of Meitu Xiu Xiu downloaded from this site. Meitu Xiu Xiu 2023 version Category: Shooting and beautification Download Meitu Xiu Xiu 2023 version is a feature-rich picture beautification and editing software

In order to make the photos taken more personalized and unique, Xiaomi Mi 14 provides photo watermark settings. By setting photo watermarks, users can add patterns, text and logos to the photos they take, so that each photo can better record precious moments and memories. Next, we will introduce how to set a photo watermark in Xiaomi 14 to make your photos more personalized and vivid. How to set photo watermark on Xiaomi Mi 14? 1. First click “Camera”. 2. Then click "Settings". 3. Then find the watermark, and then you can start shooting.

With the popularity of Douyin short videos, user interactions in the comment area have become more colorful. Some users wish to share images in comments to better express their opinions or emotions. So, how to post pictures in TikTok comments? This article will answer this question in detail and provide you with some related tips and precautions. 1. How to post pictures in Douyin comments? 1. Open Douyin: First, you need to open Douyin APP and log in to your account. 2. Find the comment area: When browsing or posting a short video, find the place where you want to comment and click the "Comment" button. 3. Enter your comment content: Enter your comment content in the comment area. 4. Choose to send a picture: In the interface for entering comment content, you will see a "picture" button or a "+" button, click

1. We use WPS to open a document. There is a watermark in it. It looks messy. How to remove it? Look down. 2. Find the Insert tab in the menu bar, select the header and footer icons under this tab, and click on them with the left mouse button. 3. At this time, the text on the page becomes gray and cannot be edited, but the watermark on the back of the text can be edited at this time. 4. Click on the watermark, you can see that this is a picture watermark, because there are several small squares around the picture, and the picture can be edited at this time. 5. Use the delete key on the keyboard to delete the picture, and you can see that the watermark is gone. 6. Double-click the mouse on the page to exit the header and footer editing mode. The text on the page returns to normal color and can be edited, but at this time the watermark on the page has disappeared. 7.

In PowerPoint, it is a common technique to display pictures one by one, which can be achieved by setting animation effects. This guide details the steps to implement this technique, including basic setup, image insertion, adding animation, and adjusting animation order and timing. Additionally, advanced settings and adjustments are provided, such as using triggers, adjusting animation speed and order, and previewing animation effects. By following these steps and tips, users can easily set up pictures to appear one after another in PowerPoint, thereby enhancing the visual impact of the presentation and grabbing the attention of the audience.

How to remove the evaluation copy text in the lower right corner of win1124H2? When we use the system, sometimes the desktop will display a transparent watermark on the lower right corner of the screen. So how do we remove this transparent watermark? Users can directly use third-party software to operate. Let this site carefully introduce to users how to remove the watermark on the win1124H2 evaluation copy. To remove the watermark on the win1124H2 evaluation copy, download the UniversalWatermarkDisabler tool. After running it, the current system version and watermark status will be displayed. If "Ready for installation" is displayed in "Status", it can be removed.
