Copy link to clipboard
Copied
Hi all,
I've got an image upload section for an admin page. I've tried countless tutorials, but I just can't seem to get anything to work the way I want it to. I'm trying to resize the uploaded image to a specific size (w=215; h=250) and maintain the transparency of the png file. All I can get to work is a simple upload that does not resize. So far I've got this:
$current_image=$_FILES['image']['name'];$extension = substr(strrchr($current_image, '.'), 1);
if ($extension != "png")
{
die('Unknown extension');
}
$new_image = $current_image;
$destination="../../assets/subfolder/".$country."/".$new_image;
$action = copy($_FILES['image']['tmp_name'], $destination);
if (!$action)
{
die('File copy failed');
}else{
Can anyone please help me get this to resize and keep the transparency? Or point me in the right direction where I can find a tutorial that I can get to work?
Thank you very much.,
Copy link to clipboard
Copied
My book, PHP Solutions, 2nd Edition, devotes an entire chapter to generating and uploading thumbnail images. It's not free, but it might help you if you're stuck.