Table of Contents
PHP image operations: 3D images, zoom, rotate, crop, add watermark (3)
旋转之前
沿着y轴旋转
沿着x轴旋转
Home Backend Development PHP Tutorial PHP image operations: 3D images, zooming, rotating, cropping, adding watermarks (3)_PHP tutorial

PHP image operations: 3D images, zooming, rotating, cropping, adding watermarks (3)_PHP tutorial

Jul 13, 2016 am 10:17 AM
image watermark

PHP image operations: 3D images, zoom, rotate, crop, add watermark (3)

Source: http://www.ido321.com/887.html

5. Image rotation with PHP

   1: <div>
Copy after login
   2:     <h4 id="旋转之前">旋转之前</h4>
Copy after login
   3:     <img  src="/static/imghw/default1.png"  data-src="http://www.bkjia.com/uploads/allimg/141009/0425435O8-0.png"  class="lazy"   style="max-width:90%" alt="PHP image operations: 3D images, zooming, rotating, cropping, adding watermarks (3)_PHP tutorial" >
Copy after login
   4: </div>
Copy after login
   5: <?php
Copy after login
   6: header("content-type","text/html;charset=utf-8");
Copy after login
   7:  
Copy after login
   8: /*
Copy after login
   9: *图片沿y轴旋转,以png&#26684;式为例
Copy after login
  10: *@param string $filename 图片的url
Copy after login
  11: */
Copy after login
  12: function turn_y($filename)
Copy after login
  13: {
Copy after login
  14:     /*创建图片资源*/
Copy after login
  15:     $backy = imagecreatefrompng($filename);
Copy after login
  16:  
Copy after login
  17:     /*获取大小*/
Copy after login
  18:     $widthy = imagesx($backy);
Copy after login
  19:     $heighty = imagesy($backy);
Copy after login
  20:  
Copy after login
  21:     /*创建新的图片资源,保存翻转后的图片*/
Copy after login
  22:     $newy = imagecreatetruecolor($widthy, $heighty);
Copy after login
  23:  
Copy after login
  24:     /*沿着y轴翻转,就是将原图从右向左按一个像素宽度向新资源中逐个复制*/
Copy after login
  25:     for ($i=0; $i < $widthy; $i&#43;&#43;) { 
Copy after login
  26:         imagecopy($newy,$backy,$widthy-$i-1,0,$i,0,1,$heighty);
Copy after login
  27:     }
Copy after login
  28:  
Copy after login
  29:     /*保存翻转后的图片*/
Copy after login
  30:     imagepng($newy,'http://www.bkjia.com/uploads/allimg/141009/0425435558-1.png');
Copy after login
  31:  
Copy after login
  32:     /*释放资源*/
Copy after login
  33:     imagedestroy($backy);
Copy after login
  34:     imagedestroy($newy);
Copy after login
  35: }
Copy after login
  36:  
Copy after login
  37: /*
Copy after login
  38: *图片沿x轴旋转,以png&#26684;式为例
Copy after login
  39: *@param string $filename 图片的url
Copy after login
  40: */
Copy after login
  41: function turn_x($filename)
Copy after login
  42: {
Copy after login
  43:     /*创建图片资源*/
Copy after login
  44:     $backx = imagecreatefrompng($filename);
Copy after login
  45:  
Copy after login
  46:     /*获取大小*/
Copy after login
  47:     $widthx = imagesx($backx);
Copy after login
  48:     $heightx = imagesy($backx);
Copy after login
  49:  
Copy after login
  50:     /*创建新的图片资源,保存翻转后的图片*/
Copy after login
  51:     $newx = imagecreatetruecolor($widthx, $heightx);
Copy after login
  52:  
Copy after login
  53:     /*沿着x轴翻转,就是将原图从上到下按一个像素宽度向新资源中逐个复制*/
Copy after login
  54:     for ($i=0; $i < $heightx; $i&#43;&#43;) { 
Copy after login
  55:         imagecopy($newx,$backx,0,$heightx-$i-1,0,$i,$widthx,1);
Copy after login
  56:     }
Copy after login
  57:  
Copy after login
  58:     /*保存翻转后的图片*/
Copy after login
  59:     imagepng($newx,'http://www.bkjia.com/uploads/allimg/141009/0425432228-2.png');
Copy after login
  60:  
Copy after login
  61:     /*释放资源*/
Copy after login
  62:     imagedestroy($backx);
Copy after login
  63:     imagedestroy($newx);
Copy after login
  64: }
Copy after login
  65: /*调用函数*/
Copy after login
  66: turn_y('http://www.bkjia.com/uploads/allimg/141009/0425435O8-0.png');
Copy after login
  67: turn_x('http://www.bkjia.com/uploads/allimg/141009/0425435O8-0.png');
Copy after login
  68: ?>
Copy after login
  69: <div style="float:left">
Copy after login
  70:     <h4 id="沿着y轴旋转">沿着y轴旋转</h4>
Copy after login
  71:     <img  src="/static/imghw/default1.png"  data-src="http://www.bkjia.com/uploads/allimg/141009/0425435558-1.png"  class="lazy"   style="max-width:90%" alt="PHP image operations: 3D images, zooming, rotating, cropping, adding watermarks (3)_PHP tutorial" >
Copy after login
  72: </div>
Copy after login
  73: <div style="float:left">
Copy after login
  74:     <h4 id="沿着x轴旋转">沿着x轴旋转</h4>
Copy after login
  75:     <img  src="/static/imghw/default1.png"  data-src="http://www.bkjia.com/uploads/allimg/141009/0425432228-2.png"  class="lazy"   style="max-width:90%" alt="PHP image operations: 3D images, zooming, rotating, cropping, adding watermarks (3)_PHP tutorial" >
Copy after login
  76: </div>
Copy after login

Effect


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/890204.htmlTechArticlePHP image operations: 3D graphics, scaling, rotation, cropping, adding watermark (3) Source: http:// www.ido321.com/887.html 5. PHP rotation of image 1: 2: Before rotation 3: 4: 5: 6: header("...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to add watermark to Meitu Xiuxiu? Share how to add watermark to beautiful photos! How to add watermark to Meitu Xiuxiu? Share how to add watermark to beautiful photos! Mar 16, 2024 pm 09:55 PM

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

How to remove watermark with Scanner How to remove watermark with Scanner Mar 05, 2024 pm 05:34 PM

Removing watermarks is a useful tool in the software Scanner. Some users are not sure how to remove watermarks in Scanner. You can click Remove Watermark in Edit PDF on the save interface to close it. Next, the editor will explain Users brought us an introduction to how to remove watermarks. If you are interested, come and take a look! Scanner King usage tutorial How to remove the watermark with Scanner King? Answer: You can click on the save interface to edit the watermark removal in the PDF. Details: 1. Enter the software and click the [Camera] icon. 2. Photograph and scan the documents that need to be watermarked. 3. Click [→] to proceed to the next step. 4. After completing editing, click [✓]. 5. Click [Edit PDF]. 6. Select [Remove Watermark] below.

How to remove watermark from clipping How to remove watermark from clipping How to remove watermark from clipping How to remove watermark from clipping Feb 22, 2024 pm 05:16 PM

Open the clip and select a template. After editing the video, click Export, click Save and share without watermark. Applicable model of the tutorial: iPhone13 System: iOS15.3.1 Version: Cutting 6.8.0 Analysis 1 Open Cutting and select a cutting template. 2. After clicking to open the template, click the cut the same style option in the lower right corner. 3Select the photo fill segment from the album and click Next. 4How to click the export option in the upper right corner of the page. 5Finally, click Save and Share without watermark. Supplement: What kind of software is Cutting? 1 Cutting is a video editing software that has comprehensive editing functions, can change speed, has filters and beauty effects, and has rich music library resources. Starting from February 2021, clipping will be supported on mobile phones, Pads, and Mac computers.

How to remove video watermark in Wink How to remove video watermark in Wink Feb 23, 2024 pm 07:22 PM

How to remove watermarks from videos in Wink? There is a tool to remove watermarks from videos in winkAPP, but most friends don’t know how to remove watermarks from videos in wink. Next is the picture of how to remove watermarks from videos in Wink brought by the editor. Text tutorial, interested users come and take a look! How to remove video watermarks in Wink 1. First open wink APP and select the [Remove Watermark] function in the homepage area; 2. Then select the video you want to remove the watermark in the album; 3. Then select the video and click the upper right corner after editing the video. [√]; 4. Finally, click [One-click Print] as shown in the figure below and then click [Process].

How to set photo watermark on Xiaomi Mi 14? How to set photo watermark on Xiaomi Mi 14? Mar 18, 2024 am 11:00 AM

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 &quot;Settings&quot;. 3. Then find the watermark, and then you can start shooting.

How to remove watermark on Xiaomi Mi 14Ultra? How to remove watermark on Xiaomi Mi 14Ultra? Feb 28, 2024 pm 02:28 PM

Xiaomi Mi 14 Ultra is a new model with very good performance and configuration. This mobile phone also adopts a unique appearance design. It has a higher appearance and is very recognizable. Many consumers who want to buy it want to know how to use Xiaomi Mi 14 Ultra. Remove watermark? , the editor of this site will introduce it to you below! How to remove watermark from Xiaomi 14Ultra? 1. Open the camera application: Find and open the pre-installed camera application on Xiaomi 14. 2. Enter the settings menu: Tap the lower right or lower left corner of the screen (depending on which version you are using) to display the additional options button. Then, select "Settings" in the pop-up menu. 3. Turn off watermark option: In the settings menu, you will see various options and parameters. Scroll down until you find the "Watermark" option

Introduction to the method of editing watermark with WPS Introduction to the method of editing watermark with WPS Mar 27, 2024 pm 02:06 PM

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.

How to Download Windows Spotlight Wallpaper Image on PC How to Download Windows Spotlight Wallpaper Image on PC Aug 23, 2023 pm 02:06 PM

Windows are never one to neglect aesthetics. From the bucolic green fields of XP to the blue swirling design of Windows 11, default desktop wallpapers have been a source of user delight for years. With Windows Spotlight, you now have direct access to beautiful, awe-inspiring images for your lock screen and desktop wallpaper every day. Unfortunately, these images don't hang out. If you have fallen in love with one of the Windows spotlight images, then you will want to know how to download them so that you can keep them as your background for a while. Here's everything you need to know. What is WindowsSpotlight? Window Spotlight is an automatic wallpaper updater available from Personalization &gt in the Settings app

See all articles