Plupload Resize and Upload at once - php

I have using Plupload to upload images, but now I need a thumbnail of the images too.
I know how the resize works in Plupload but I need it to upload the original file, then the RESIZED thumnail of the image, so I need both of them.
My final aim is to get the original picture and a thumnail for ex.:
picture.jpg
_picture.jpg
The _ means that is a thumbnail.
I have tried many ways (for ex.: cwUpload worked well, but I cant call it with the pictures)
I have tried to make duplicaton var uploader2 = new plupload.Uploader({..}) and make only the resize but not worked.
My idea is was) to combine a plupload upload then a plupload resize upload somehow.
Can you help me a bit how to reach it?
Thanks!

You should accept uploading the original image and resize it afterwards, if the upload was successful.
I've implemented such a function in my own project.
Look here: https://github.com/OpenBookCase/OpenBookCase/blob/master/lib/API.php#L389

Related

How to create a thumbnail for video file

I have been working on php for a while and i stuck at the point where i need to create thumbnail for video file using ffmpeg.
I looked up for same, but did not get any solution yet.
I found so many solutions to create a thumbnail from video file, but i want to create a thumbnail for video file.
EX. i will upload video file and image file and then this image file will be set as a thumbnail for a video.
Any solution .... if possible using ffmpeg then it would be great
Thanks in advance :)

move_uploaded_file - prevent rotation / ignore exif data

working on a upload image feature for my custom CMS.
I have completed the feature, but have an image when uploading images from mobile devices. Only tested on IOS so far but the issue is:
If the user selects to take a picture and does so in portrait, when the image is saved it is rotated -90 degrees.
It is however fine in landscape. After some research I have found that it uses the exif data from an image and looks at the rotation. Is there a way to ignore this information and keep the image as it was taken?
Using a class to upload images I found on GitHub called bulletproof:
https://github.com/samayo/bulletproof
The link to the actual class:
https://github.com/samayo/bulletproof/blob/master/src/bulletproof.php
And this is the upload part from that:
$moveUploadedFile = move_uploaded_file($fileToUpload["tmp_name"], $this->uploadDir . "/" . $newFileName);
Thanks, Craig.
This PHP class doesn't apply any image rotation. A search for imagerotate() fails.
So this is not PHP related and you might ensure that by testing the image upload from another, non-iOS client.
Then, you might want to find out, if iOS has a setting to send the native, unmodifed image or if you have to apply some "rotate"-correction on iOS-device side to get a correct rotation before sending.
In other words: i believe the image is transformed on IOS device side, before the image is send.
iOS PNG Image rotated 90 degrees
iOS4 landscape photos sideways in e-mail

Image upload crop resize save to folder

I want from user to upload an image of any size for (jpg,png,gif) format. After uploading the image I want him to crop the image (client side) using jquery and save that cropped image (php) to application folder.
Please tell me the feasible solution to make this functionality working fine.
ImageMagick is used for croping images:
http://www.sitepoint.com/crop-and-resize-images-with-imagemagick/
For using ajax:
http://www.sanwebe.com/2012/05/ajax-image-upload-and-resize-with-jquery-and-php
Given that you already have the PHP code to crop, use one of this plugins to allow the user define how she wants to crop the image and provide the data you need:
Guillotine: Very lightweight plugin that allows to crop, zoom and rotate images with touch support and it's responsive (demo).
Jcrop: Allows free selection cropping (demo).
It is simple image crop using jquery and php using cropbox.js
Please watch the following video
Simple image crop

Resizing before Uploading in PHP SWF Uploader Overlay DEMO

How to add the facility "resize image before upload" in SWF Overlay Demo.
http://demo.swfupload.org/v250beta3/resizedemo/index.php
http://demo.swfupload.org/v220/overlaydemo/index.php
I want this resizing facility(1st link) in overlay demo(2nd). Could you please help?
is it possible to get "image resizing before upload" in the second link ?
They way I've done it is I let the user upload the image to a temporary location using this ajax flash uploader... http://valums.com/ajax-upload/
The flash uploads to a php script that creates 2 temporary version, the first one a resized version and the second the original. Then I return a json response with the path to the temporary files.
Then I load the resized version amd use this cropping http://deepliquid.com/content/Jcrop.html with a ratio constraint to get the portion of the picture to capture.
To complete the process the user submits the selected coordinates and the path to the temporary images to another scirpt which then takes the coordinates maps them to the original image and extract the portion of the image and resize it to the desired size using GD.

Image upload and jCrop and codeigniter

I am trying to build a system that allows a user to select an image from their own computer, and crop it using the jCrop tool from jQuery. My question is can I show the image the user has selected from their system without uploading it to a system, I dont really want to do two uploads, unless I can do the first upload silently? Any help would be great.
Thank you.
You don't have to upload twice. Just upload the image at first time
Use jCrop and send image Thumbnail's coordinates(x,y), width and height.
Resize Image according to them
AFAIK, not using JavaScript and HTML (4) at the moment.
Flash can do image processing before upload - SWFUpload for example can resize images before uploading (doesn't support cropping though), but I don't know an Open Source implementation of a Cropping tool in Flash.
It will probably also be possible using HTML 5.
However, I don't see how you would need two uploads to do this? Isn't it 1. Upload 2. Show with Cropper 3. send Crop info to PHP script that processes the uploaded file?

Categories