Ok so i use this function to create thumbnails:
Code: [Select]function createthumb($name,$filename,$new_w,$new_h)
{
$system=explode('.',$name);
$src_img=imagecreatefrompng($name);
$old_x=imageSX($src_img);
$old_y=imageSY($src_img);
if ($old_x > $old_y)
{
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y)
{
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y)
{
$thumb_w=$new_w;
$thumb_h=$new_h;
}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
if (preg_match("/png/",$system[1]))
{
imagepng($dst_img,$filename);
} else {
imagejpeg($dst_img,$filename);
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
It works and all, but the problem is that for my gallery i need all the pictures to be exactly 150x150, but i also need the images to keep their aspect ratio (so they don't look ugly) so i was thinking i could add like borders that would fill up the space. Ok imagine the function resizes the image to 100x150 so i make the image centered and add 50px wide white black borders on each side of the picture, so it isn't stretched out (keeps it's ratio) and is also 150x150.
The question is, how do i do this?
GET * FROM _____ Except?
I have a site that is for stock photography.This section of the code calls images to display on the main page, based on several variables (new images, featured images, most downloaded, highest rated,
Parse error: syntax error, unexpected T_ELSEIF in /home/......html/item.php on l
I do not know what is wrong with this. Hope some one can help. I do nto want to post the entire site because it is to long. However, here is the few lines:$TPL_closed_auctions_list .=
PHP4 to PHP5 Conversion
Hi Everyone,I am working on a site that is built up on PHP4 and each page is being started from <? instead of <?php as of PHP5.I want to convert this <? to <?php on every
Month String to Numeric?
Hi guys,Given a month as a string, is there a simple way to find the numeric representation of said month?I've used a switch statement but I'm wondring if there is a more elegant way of doing
LIMIT $start, 10... how to pass last value queried into next page with GET??
Ok I know how to display the first or last 10 results of a query...$result = mysql_query("SELECT * FROM messages ORDER BY timemsg DESC LIMIT 10");In a perfect world all the rows ID's would
Amatuer requiring assistance
Beginner and amateur in need of assistanceMy Site - (Spare Parts for Domestic Appliances)I've gone as far as I can go on my own and need guidanceWhat I require is custom searches - I need to return
Save User Inputs while javascript reloading!
hi..i have written a PHP code in which i reload the page when user selects a value in dropdown...Code: function reload(form){var
listcube issue
Hi
PHP XML extraction text
I would like to extract an xml text and have that text directly echo(print) out on my web page. Here's the xml i want to extract:http://dblp.uni-trier.de/search/author?xauthor=SchekWhat I
PHP and Javascript
Hi Guys,Im trying to load the contents of an html file into a text area for editing, this is the code I have so far but it doesnt seem to be working. I think it's because some of the $line have