- take an image from the server, crop it to a multiple of 75x70px (w x h) and then resize it to 75 x 70px
- save the thumbnail to the server
- display the thumbnail
The reason I want to save it is I want to use an IF/ELSE statement when calling the image to see if a thumbnail has already been created for this image and if so, just use the one already created.
The code I have so far is very basic and is as follows (currently running on local server only):
Code: Select all
<ul id="car">
<?php
$conn = mysql_connect("localhost", "root", "passwordhere");
mysql_select_db("12345678_shop1", $conn);
$sql = "SELECT * FROM products ORDER BY RAND() LIMIT 16";
$result = mysql_query($sql,$conn);
while ($newArray = mysql_fetch_array($result)) {
$products_id = $newArray['products_id'];
$products_image = $newArray['products_image'];
echo "<li><a href=\"product_info.php?products_id=" . $products_id . "\"><img src=\"" . HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . "$products_image\" width=\"75\" height=\"70\" /></a></li>";
}
?>
</ul>
It's ok if it's just JPG but GIF support would be great also.
Any help would be great.