Drag and Drop photo merge - php

This is a pretty broad question but something I'd like input on. I am attempting to create an interface where users can drag a photo from their desktop into a canvas in the browser. That canvas would have a fixed image in it already (acting as a watermark). I'd like the user to be able to drag and scale their image in the canvas until they are satisfied, then be able to save the image. The idea behind this being almost like a photo bomb but they choose a photo to merge theirs with.
I have done some research on using HTML5 canvas and also on using jQuery/PHP for the task but haven't decided which route to take yet.
Any advice would be appreciated.

Related

Preview video from thumbnail

Recently stumbled upon a stock video footage site http://www.pond5.com/stock-video-footage/1/*.html , and saw that they had a preview of a video when the user hovered over a thumbnail. I want to recreate this, because it seems like useful practice and it will allow me to workout my web developing muscles.
I would like to be able to preview a video when a user hovers over a thumbnail.
For example like pond5.com. Audio is not necessary, but I would like it to look smooth like a video rather than a video preview that contains a frame every 5 seconds.
On pond5.com, I originally thought they used a gif, but it plays very smoothly. Some also contain audio. As far as I thought, audio can't be used in .GIFs
Is this a case where I would have to just upload a 2nd video for the preview?
Thank you for any help.
Pond5, the website you specifically mentioned, creates a video thumbnail with watermark and lowered quality and stores it. It is then played back using JavaScript to dynamically load a div element that contains the flash player. So no GIFs are involved. You do need to upload a 2nd video, but the steps to this project are as follows:
Server-side video thumbnail/watermarking: Not sure if there are any PHP packages that are up to the task on this one. I would write a more powerful program in C++ or C#. If you go with C#, quick and easy solution would be Microsoft Expression Encoder.
Flash/Silverlight/HTML5 video player: To play the video.
Client-side JavaScript: To load the fancy popup and the aforementioned video player. Note that you might need to use PHP and a database engine to load the thumbnail URL for the video requested.
This is what Pond5, and what many other stock-footage sites use, and the basic outline of what you would need to do to achieve similar results.

Creating active areas (hot spots) in image with JavaScript and PHP

I want to build an application in which an image is presented. When one click area in the image then it can result with different outcomes, depends on the area in which he/she clicked. The outcome is always replacement of the image with another one-sometimes similar image with only small area if it different from the original picture.
My question is whether this can be done when the images are stored on external server so it would be smooth enough and wouldn't feel like the computer have to download the other picture (meaning that it would feel more like in game when action lead to immediate outcome).
You could preload all images before starting your game.
Check this jquery solution for instance http://www.farinspace.com/jquery-image-preload-plugin/
This way you will get a smooth result on user interaction

Combine (merge) images with drag & drop

Image this scenario:
There is a picture locally in my server, where a sketch is displayed, and there is a "blank hole" area on it.
Then, a user can upload another picture to my server.
What i'm trying to achieve is this:
After image upload is finished, the first image (the one with the "hole") is displayed, and behind it is displayed the user's photo, so that you can see it through the "blank hole" area of the first photo.
Then the user can move his picture (drag & drop style) so he can choose which area of it is visible through the "blank hole".
Then i would like to save the result - by merging the 2 photos or keeping the position of the user's picture in a db so i can display it again later.
(Something like this more or less)
What kind of technollogy should i look for? I'd guess javascript(for the drag & drop) or html5 or php(for merging the photo)?
Are there any libraries that i can use?
I hope my explanation isn't too messy, i didn't even know how to google for it.
I don't know if there are better solutions (and I suspect there are), but I suspect all of this can be done with not too much trouble. Here's a rundown of one way to approach the problem:
Use a JavaScript-powered "upload widget" such as uploadify to enable your user to upload "his" image to the server. The server will do some processing on the image (e.g. resize and crop to suitable dimensions) and save it using e.g. PHP's gd library. It will return a URL to the "prepared" image back to the browser -- all of this through AJAX.
The browser then has a URL to the user's image, so using more Javascript you can dynamically add an element that displays it inside the page and allow the user to move it around with e.g. jQuery draggable. Compositing the draggable image behind your static content (the image with the "hole") is a detail you will have to take care of using a combination of HTML, CSS and again Javascript.
When the user is done, use an AJAX call (e.g. again jQuery) to inform the server of the image's positioning (this will be available through the facilities of the Javascipt framework you have selected). The server can then "compose" the two images together (gd or something equivalent once more) and return to the browser a URL through which the final product can be accessed.
Of course there are lots of details to take care of here, but knowing exactly what the plan is should help you get started.
Have a look at the PHP GD extension. If it's installed, it's pretty easy to have an image (with a transparent center) to be merged on top of a second image that a user would upload.
Have a look at http://php.net/manual/en/function.imagecopymerge.php
Ok to get you started, yes use a JavaScript drag and drop module for the placing of the image. You can record the x /y cordinates relative to the container. Do the image merging with a PHP image library / Class. Something like this : http://www.phpclasses.org/package/3930-PHP-Generate-an-image-from-the-combination-of-2-images.html

A Responsive Photo-wall Gallery with Swipe Functionality

I'm looking to build a javascript/jquery gallery that meets the criteria below, and would love to know if there are any existing gallery modules that have all/most of these features:
1. Photo wall with zoom (single view) functionality. eg. http://tympanus.net/Tutorials/SlidingPanelPhotowallGallery/
2. Responsive, so that the photo wall images tile properly for desktop & mobile devices, and reshuffle if the user resizes their browser. eg. http://isotope.metafizzy.co/
3. (optional but desirable). If a user is on a mobile device, allow them to swipe through single-view images.
In a nutshell. A user will go to the thumbnail wall, select an image, and can then either swipe through more enlarged photos, or switch back to the wall.
The photos will be sourced from a folder on the server. Moderators are simply camera girls, who will upload images from their digital cameras to this folder via ftp - They wont resize / optimise the images, so it would be great if this could happen in the process somewhere too.
We are hosting on a PHP / Linux environment.
Have a look at jQuery Mason: http://masonry.desandro.com/
It can be used as a responsive wall.
What your asking for is not called 'zoom' (that is another effect), you seem to what what is called a lightbox. There are a lot of these, here is a comparison, http://planetozh.com/projects/lightbox-clones/
To re-size images your going to have to write some php to make use of image GD or imagemagick, here is a tutorial, http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/ or possibly a script, http://shiftingpixel.com/2008/03/03/smart-image-resizer/ (or timthumb.php).
For serving them your going to have to write some php with your javascript.
There is no all in one solution for what you asking for, you're going to have to write it or hire someone to do so.
As far as I know you have to create a plugin or write you own jquery functions for getting all customized features.(that will be very good in sense of performance and maintenance)
for zooming functionality you can use some of the modal windows with ajax call or you can create.
to achieve this you have to write good css so that your photo aligned according to screen.reshuffle will be handled if you write good css.
yes you can achieve this by detecting the browser navigator and changing the css and javascript accordingly.
For pre processing images(re sizing,dynamically generating thumbanails) you can opt for php backend solutions.
And no worries you can handle images from folder via Ajax and show them as they requires.

How can I generate a thumbnail of a web page for a facebook post?

My app is posting to users' Facebook walls, and linking to a page they have created. The page is in html. I'd like to be able to put a thumbnail of the page as the image on the wall post. I'm not sure whether this is possible or not. Anyone have any ideas?
If it helps, the page itself is stored as a series of 'elements'... for each one, I know the size and position of the element, and the content (which may be text or an image). So I can pull all that in from the database.
I guess it would be sufficient to create a thumbnail using php at the point when the user clicks 'Publish This to my wall', if that's easier than doing it on the fly - I can save the image and then link to it.
Any ideas?
I create thumbnails for my site using CutyCapt, which works very well indeed on both Windows and Linux. You can use exec to invoke this from php.
There are also web services that allow you a quota of free thumbnail snapshots, that are easy to integrate into your website. e.g.
http://www.websnapr.com/
or
http://webthumb.bluga.net/home
I figured out how to do this. I used the PHP gd library, which allows you to create a base image and then add images and text. Works pretty well.

Categories