show uploaded files in gridview using php - php

i uploaded files into my server image folder.
after upload want to display the uploaded files as thumbnails in the grid view or anything(like windows explorer), also want to select multi files from grid view and download it.. any help to be appreciated.. im using php...
thank you so much...

Here some pointers to get you started:
Loop through the images and simply output them all, then use some CSS padding and width setting to get them into a grid. Alternatively, output them in a table, inserting a </tr><tr> every n loop iterations.
Add a checkbox input using some uniquely identifying value to each image to make it "selectable".
Use some Javascript to spice up the selection process and make it more "Explorer-like".
Try it and come back with more specific questions as you encounter them (after trying to solve them yourself first).

I think you need a PHP Photo Gallery instead. There is an awesome gallery Plogger that you can use.
Otherwise, here are more PHP galleries.

That would be a rather large project to undertake. Try a premade package like:
http://www.gerd-tentler.de/tools/filemanager/ (simple and free)
or
http://www.filerun.com/ (looks good, but requires license)

with the help of <table><tr><td>... you can make a grid view and with using the php code collect all uploaded files into an array then show the file in the grid view by inserting php code in between. In that you can give check boxes and place php code in between to generate an array while user cliks each check box correspondin to that file a link should be passed to the array and then post the values on the download button clik, in the next step you can use the php zip function to ip these file in the array and send it to user as download link

Related

Get small thumbnails from bigger photos

I have a galery of users that show all of user photos. I want to have small thumbnails for each photos.
How to make it?
Also I notice some website even create thumbnail that focus on the face part of the original photos.
I don't have any code just looking for suggestions.
Im using PHP, Codeigniter, Angularjs, Jquery.
Thank you!
In your controller when receiving the file, before uploading it, you need to do some processing to it. each image you will save it in 4 or 3 sizes, it will be like this for image called imageHello.jpg:`
site.com/images/large/imageHello.jpg
site.com/images/small/imageHello.jpg
site.com/images/thump/imageHello.jpg
So basically it will be site.com/images/[size]/imageHello.jpg, in the front end side you will file the size with what you want based on the page.
for zooming you can use this library, look at this example

is it possible to pass a file uploaded using php to a javascript as input?

Im working on a tile based tmx editor and currently have file saving working. Currently it passes the tmx to a php file called endpoint that downloads the file. it can be viewed here www.jamesplanet.net/growtopiamapeditor/beta.
What I need to know is it possible to use php to upload a file then pass the file to javascript to load into the editor?
If you need a copy of the source I can put a link
If this question isn't worded correctly or hasn't enough information please don't down vote. instead let me know what else you need to know.
Basically this need to work , you have to use iframe , which you can create on the fly and use it as posted back to php code. This is one of the common way to achieve this. There will so many third party using this concept
Possible solution: You could have the PHP script download the file, insert the file details into a table and only return a name and/or id of how to get the file details from the table in JSON format for the javascript to add the file to the list.

upload image, then put file path into a form

I just need a bit of advice on what direction to go with something I am creating.
It is a simple php based webpage for our sports and social members in our office, allowing them to create, edit, view and delete events for all members to see. Events like day trips, bbq's and all kinds of things like that.
So far I have it all working as I would like, other than one thing, being the event logos.
At present, the events are all stored in a mysql database, in one table, with a column for every aspect of the event; time, date, price, venue etc etc.
I also have two columns for the event logos, one for the venue logo, and one for the general event logo.
What I need advice on, is the best way to create a page that allows a user to upload an image to the server, browse the images already uploaded, select one, and have it's file path entered into a text input when creating the event.
Could someone offer their suggestions on the best way to go about this, or offer an alternative method for selecting and inputting a logo for the event?
Thanks
The Uploadify jQuery plugin works really well for batch and/or AJAX uploads. The way I'd handle your situation would be this:
Show all images on the same page with the form, and give each image a related radio button with the image path as the button's value, so the user simply checks the image they want to use,
If the user wants to upload images, use the Uploadify plugin and it's AJAX callback functions to dynamically populate the existing list of radio buttons.
The comment I made on your question, asking wether you store images (or their file paths) was because I think it would be much easier (and cleaner) for you to retrieve a list of uploaded images by querying a database. Personally, I don't store images in a database, only their file paths, and use PHP to handle any images that need to be deleted or moved. It's easier to assing images to other entities (especially in many-to-many relationships) that way.
If you don't want to store images' data in a separate table, I guess you'd have to use PHP file system functions to get a list of files already uploaded (glob comes to mind, although there could be better functions or this).
EDIT:
There is also a very good AJAX file browser plugin - ckFinder, but I have very little experience with it and can't really comment on its workflow, but if you find it to be a more elegant solution, you should try it out.
if i could understand your question you want to associate the image with the event i.e tag the image with the event right ??
you can use jquery's attr() function to grab the src of img and put it in input field
I ended up storing the images in the database itself.
Saved some hassle on the file path side of things.

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

Image manipulation with JQuery and PHP

I want to do some kind of image editor, after I upload more images I make a list with all the thumbnails!
After, I want to be able to click on one thumb and rotate, duplicate, drag and drop (to change positions of the images), and delete the image. I want all the images to be in a php array. If an image is deleted I want to delete the row from array too. If a image is drag-and-dropped I want to change the position in the array too.
Ok, after the user uploads all the images and modifies some of them, how can I make a DONE button to save the positions of the images?
I made all ready all this, i only need to know how i can save the list of images after i "edit" with jquery? i need a save button or something
For this small project how do you suggest I save the images? (to make a table in mysql and store the names of the images in the database depending on the session id? depending on the IP?)
Any suggestions are welcome!
Way, waaay too all-encompassing question.
My suggestions:
Get familiar with gd or ImageMagick
Get familiar with jQuery UI, especially the drag & drop functionality
Store images in a temp folder on disk
Write a caching mechanism around it that'll clear the folder of unused images in regular intervals
Hashes can help to retrieve images from cache
Store state in a session
Do some work on this and come back with more specific questions.

Categories