


THINKPHP+JS realizes the implementation of zoom picture screenshot_PHP tutorial
Author: Yang Xinqi
Original link: http://www.cnblogs.com/scotoma/archive/2010/03/05/1679477.html
Tonight, a big brother from the TP forum added me, saying that he also encountered this problem, haha! Come to think of it, I have encountered many things, should I share it? In fact, many of my things came from others, taken from the Internet and used on the Internet! Only by sharing more can we improve!
How to implement it
Upload pictures -- Save and display pictures -- JS gets thumbnail parameters -- Submit location parameters -- Image scaling and saving class processing pictures -- Save captured pictures -- Update database -- Jump
The last few screenshots
The following is an example screenshot
Main implementation code
public function cutimg()
{
$result = $this->upload('temp');
if (!is_array($result))
{
$this->redirect('index');
}
else
{
$this->assign('imgurl', '__ROOT__/' . C('ATTACHDIR') . '/temp/' . $result[0]['savename' ]);
$this->assign('imgname', $result[0]['savename']);
$this->display();
}
}
public function setavatar()
{
if (!empty($_REQUEST['cut_pos']))
{
// import('ORG.Util.ImageResize');
require('ImageResize.class.php');
$imgresize = new ImageResize();
// use the full path
$url = C('ATTACHDIR') . '/temp/' . trim($_POST['imgname']);
$imgresize->load($url);
dump($url);
$posary = explode(',', $_REQUEST['cut_pos']);
foreach($posary as $ k => $v)
$posary[$k] = intval($v);
if ($posary[2] > 0 && $posary[3] > 0) $imgresize->resize($posary[2], $posary[3]);
dump($posary);
// create filename rule
$uico = time( ) . '.jpg';
dump($uico);
$path = C('AVATAR');
// save 120*120 image
$imgresize->cut(120 , 120, intval($posary[0]), intval($posary[1]));
$large = 'l_' . $uico;
$imgresize->save($path . $large );
echo '
// update database
}
else
{
// error reporting
}
}
Source code download address: Click to download other ones and improve them yourself. Please visit the TP framework required to run Download http://www.thinkphp.cn, and then download the expansion pack, because the Upload class is used!

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

Recently, many users have been asking the editor, how to download links starting with 115://? If you want to download links starting with 115://, you need to use the 115 browser. After you download the 115 browser, let's take a look at the download tutorial compiled by the editor below. Introduction to how to download links starting with 115:// 1. Log in to 115.com, download and install the 115 browser. 2. Enter: chrome://extensions/ in the 115 browser address bar, enter the extension center, search for Tampermonkey, and install the corresponding plug-in. 3. Enter in the address bar of 115 browser: Grease Monkey Script: https://greasyfork.org/en/

As part of the WeChat ecosystem, WeChat video accounts have gradually become an important promotion tool for content creators and merchants. Getting links to video accounts on this platform is crucial for sharing and disseminating content. The following will introduce in detail how to obtain the WeChat video account link and how to add product links to the video account to improve the dissemination effect of the content. 1. How to get the WeChat video account link? After posting a video on your WeChat video account, the system will automatically create a video link. Authors can copy the link after publishing to facilitate sharing and dissemination. After logging in to your WeChat video account, you can browse the homepage of your video account. On the home page, each video is accompanied by a corresponding link so you can copy or share it directly. 3. Search video account: Enter the video account name in the WeChat search box

If you don't have control over the zoom level in Safari, getting things done can be tricky. So if Safari looks zoomed out, that might be a problem for you. Here are a few ways you can fix this minor zoom issue in Safari. 1. Cursor magnification: Select "Display" > "Cursor magnification" in the Safari menu bar. This will make the cursor more visible on the screen, making it easier to control. 2. Move the mouse: This may sound simple, but sometimes just moving the mouse to another location on the screen may automatically return it to normal size. 3. Use Keyboard Shortcuts Fix 1 – Reset Zoom Level You can control the zoom level directly from the Safari browser. Step 1 – When you are in Safari

1. Press the win key + r key, enter regedit, and click OK. 2. In the opened registry editor window, expand: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlGraphicsDriversDCI, select Timeout on the right and double-click. 3. Then change 7 in [Numeric Data] to 0, and confirm to exit.

Screenshot feature not working on your iPhone? Taking a screenshot is very easy as you just need to hold down the Volume Up button and the Power button at the same time to grab your phone screen. However, there are other ways to capture frames on the device. Fix 1 – Using Assistive Touch Take a screenshot using the Assistive Touch feature. Step 1 – Go to your phone settings. Step 2 – Next, tap to open Accessibility settings. Step 3 – Open Touch settings. Step 4 – Next, open the Assistive Touch settings. Step 5 – Turn on Assistive Touch on your phone. Step 6 – Open “Customize Top Menu” to access it. Step 7 – Now you just need to link any of these functions to your screen capture. So click on the first

How to implement dual WeChat login on Huawei mobile phones? With the rise of social media, WeChat has become one of the indispensable communication tools in people's daily lives. However, many people may encounter a problem: logging into multiple WeChat accounts at the same time on the same mobile phone. For Huawei mobile phone users, it is not difficult to achieve dual WeChat login. This article will introduce how to achieve dual WeChat login on Huawei mobile phones. First of all, the EMUI system that comes with Huawei mobile phones provides a very convenient function - dual application opening. Through the application dual opening function, users can simultaneously

How to use shortcut keys to take screenshots in Win8? In our daily use of computers, we often need to take screenshots of the content on the screen. For users of Windows 8 system, taking screenshots through shortcut keys is a convenient and efficient operation method. In this article, we will introduce several commonly used shortcut keys to take screenshots in Windows 8 system to help you take screenshots more quickly. The first method is to use the "Win key + PrintScreen key" key combination to perform full

When we use word documents to edit files, sometimes there are many pages. We want to display them side by side and check the overall effect. However, because we don’t know how to operate, we often need to scroll for a long time to view page by page. I don’t know if you have ever encountered a similar situation. In fact, we can easily solve it at this time as long as we learn how to set the word zoom pages side by side. Below, let’s take a look and learn together. First, we create and open a new page in the Word document, and then enter some simple content to make it easier to distinguish. 2. For example, if we want to realize word zoom and side-by-side display, we need to find [View] in the menu bar, and then select [Multiple Pages] in the view tool options, as shown in the figure below: 3. Find [Multiple Pages] and click,
