Jump to content

Update/Choose an image as the cover album


Lykos22

Recommended Posts

Hi, i'd like some help please. I have a gallery page that contains albums and i'd like to put to the album an image cover that can be updated anytime, but i'm not quite sure how to do that.In the admin area (shown in the image i uploaded) i have a page that displays in a do-while loop all images that belong to a specific album and in order to set the cover for the album i have to choose an image by clicking a radio button.

<table width="100%" border="0" align="left" cellpadding="5" cellspacing="0" id="images">        <tr align="left">            <th>Inc. Id</th>            <th>Image:</th>		    <th>Album Cover:</th>            <th>Delete</th>	    </tr>        <?php do{ ?>        <tr>            <td><?php echo $row_images['image_id']; ?></td>            <td><img src="../_uploads/<?php echo $row_images['album_name']; ?>/<?php echo $row_images['image_name'].".".$row_images['image_ext']; ?>" width="150" /></td>            <td><input type="radio" name="cover" value="<?php echo $row_images['image_id']; ?>"  /></td>            <td><input type="checkbox" name="del[]" value="<?php echo $row_images['image_id']; ?>" /></td>        </tr>        <?php }while($row_images = mysql_fetch_assoc($get_images)); ?>        <tr>            <td> </td>            <td> </td>            <td> </td>            <td><input type="submit" name="submit" id="submit" value="Ok" /></td>        </tr>    </table>

How can i do that?

post-60268-0-39862200-1346922336_thumb.jpg

Link to comment
Share on other sites

Use your buttons to select/deselect an image, send that request to your script (if the album covers where hard coded you won't need sql), and display. Viola! BTW, put your requests in a form.

Link to comment
Share on other sites

I don't know how is your image and album scheme had been set in your database. you can have album table and image table seperately. in album table put a colum for coverPhoto which will hold a reference id of image which will store the id of a image. images table will hold the album reference. When you fetch out images by its albums you can choose a particular image id and sumbit the form. when you submit the form you will insert the image id in album's "coverPhoto" column.

Edited by birbal
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...