change position of image in image gallery using php - php

Hi i am working on a photo gallery. Here all images are coming from mysql database table. The images are uploaded from the admin panel. I am using php to upload and fetch images from database table. Till here all things are working fine. Now i have to implement a system where user should be able to define the position of the image in the image gallery and image positions should be swiped with one another image. In the gallery page I am showing 16 images in four rows and after that pagination starts. So will it be possible to implement such a system in my image gallery?

If I understand what you want to do correctly then you might want to check out this jQuery plugin: http://isotope.metafizzy.co/

Related

Image from database not appearing in same dimension as without database

I am making an e-commerce website in php with mysql database, I am using a web template for front-end, the issue is when I try to upload the image from database, it is not showing in proper dimension, however when i upload the same image without database it works and shows in proper size as defined in template. I don't know why is this happening because there are same css and same image class define for both.
Here is the screenshot of image in without database:
And below with fetching from database:
I am stuck how to make image display same as without database.
Simply add width and height to the image at front end and only retrieve image in src tag
This can fix your problem
& if it didn't fix please provide your code snap

How to make an image selector for specific content

When creating a new page I want to select an image from a gallery of all images previously uploaded. I've tried searching for a solution for a few hours but can't seem to find any good answers. I already know how to upload and display the images to a gallery from the database.
What I don't know is how to make it so you can select an image and assign it to that page/content.
It's not something that happens automatically. You have to code it.
The algorithm would look something like this:
Display thumbnails with the url/id of the full size picture (see Creating a thumbnail from an uploaded image);
On click, add the url of the picture you want to use on that page.

Upload image and associate it with row on database

I'm trying to do this with cakephp.
I will have a form that will allow the user to type in a school name, school phone number, and also upload a pre determined sized image as a thumbnail for that school. Then when that form is submitted, on the webpage I want it to display that thumbnail with the associated school.
How do I accomplish uploading a image through cakephp, and somehow associated that in my mySQL database?
Adding onto question #1, how would I display that image in a view?
In order to link an image to your database, you can also use the following method:
Create an "img" column in your table
When uploading your image to the server (you can refer to https://stackoverflow.com/questions/9673408/simple-tutorial-for-file-uploads-in-cakephp-2-0 for that) save your pathname in a variable
Save this variable (example "http://www.domain.com/gallery/image1.jpg") in the "img" column in your table
Then when displaying the image in your view, just use this value from the database:
<img src="<?php echo $data.img ?>" />
(above code example is not with cakephp)
There is a great plugin for handling image uploads which will do all this for you.
https://github.com/josegonzalez/upload
It will also associate the upload with a Model, either on the model or joined.
To display images in the view, you should use the Html helper.
$this->Html->image('../files/<Model>/<field>);

How to send an image from one page to another page using PHP

I have a project am working on,, its about (Graphical Password) it's an authentication security system (Web Based), which ask the user to register by entering his information such as (first name.. last name.. etc ) and with these information there will be a group of images with each image has a number written below it ,, so the user will enter his info like usually and will be an extra field for (image number) the user write the number of the image that he want ,,(the images will be previewed as thumbnails in the page). at the end he click submit, the information it will be stored in database using (PHPMyAdmin),in the database there will be columns for each data plus a column for image number, it will be storing the image number ONLY not the images, the images stored in a folder with its names from (1-20), till here no problem..
The Problem is : When the user click submit it should open another page and it should display the image that he chosen before from the previews page with big size image so later i can do some processing on the image..
My Question is : How to send that image to another page by using PHP language..
Am using DreamWeaver CS6, here is a photo of the site http://www.4shared.com/photo/YcBeAhsz/Capture.html?
and the code is here : http://www.4shared.com/file/unOI9Ejs/registeration_page.html?
I hope my question is clear and i wish i can get some answers.. thanks in advance..
This is a little tricky without know the code your using.
You can store the images you get to the web server by:
file_put_contents('image1.gif',file_get_contents('http://static.php.net/www.php.net/images/php.gif'));
The on the next page display the image back.
<?php
$user_picked_img_id = 1;
?>
<img src="image<?php echo $user_picked_img_id ?>.gif"/>
Let me know if that fits what you are trying to do.

How do I make a gallery in WordPress without using a plugin?

I have created a gallery in a WordPress post using WordPress's native media gallery and it shows me the images as gallery thumbnails in rows and columns which is exactly what I want.
But when I click on any of the thumbnail it opens the direct image link. I want that the image should be shown in my blogs environment. I would actually want it to show on the same page itself. but if not that I don't want it to open as a direct image. Is there a template file or something I could make for opening those images. I think image.php, but I have no idea how to go about it.
Help..?
Thanks
When you're inserting a gallery into your post, you can select how to link to the images. See screenshot: http://cl.ly/2yYA
Just select 'attachment page' and you'll get an individual page with commenting for that photo. Is that what you were looking for? You can edit the template of that page using attachment.php.

Categories