Jump to content

Search the Community

Showing results for tags 'scale'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. i have this code which will resize the uploaded image to its max level. all i want is to transfer my images into a folder if i will use this format move_uploaded_file($_FILES['image']['tmp_name'],'uploads/'. $_FILES['image']['name']); only one image will be place on the folder and its the original image. move_uploaded_file($_FILES['image']['tmp_name'],$_FILES['image']['name']); if i will used this code all resize images will be displayed but not in the folder which i want the image to be place upload_image.php
  2. I found a script that resizes all images in a given directory to a new size. I need some guidance to modify this script to my needs. The script resizes images to a specified image width and height. I would like to change that to make it scale the image to half the original size if it is above a certain size. I would also like for it to create a new image of a given size of 150px * 150px [icons]. How can I achieve this? <?php //Maximize script execution time ini_set('max_execution_time', 0); //Initial settings, Just specify Source and Destination Image folder. $ImagesDirectory = 'images/gallery/'; //Source Image Directory End with Slash $DestImagesDirectory = 'images/main/'; //Destination Image Directory End with Slash $NewImageWidth = 500; //New Width of Image $NewImageHeight = 500; // New Height of Image $Quality = 80; //Image Quality //Open Source Image directory, loop through each Image and resize it. if($dir = opendir($ImagesDirectory)){ while(($file = readdir($dir))!== false){ $imagePath = $ImagesDirectory.$file; $destPath = $DestImagesDirectory.$file; $checkValidImage = @getimagesize($imagePath); if(file_exists($imagePath) && $checkValidImage) //Continue only if 2 given parameters are true { //Image looks valid, resize. if(resizeImage($imagePath,$destPath,$NewImageWidth,$NewImageHeight,$Quality)) { echo $file.' resize Success!<br />'; /* Now Image is resized, may be save information in database? */ }else{ echo $file.' resize Failed!<br />'; } } } closedir($dir); } //Function that resizes image. function resizeImage($SrcImage,$DestImage, $MaxWidth,$MaxHeight,$Quality) { list($iWidth,$iHeight,$type) = getimagesize($SrcImage); $ImageScale = min($MaxWidth/$iWidth, $MaxHeight/$iHeight); $NewWidth = ceil($ImageScale*$iWidth); $NewHeight = ceil($ImageScale*$iHeight); $NewCanves = imagecreatetruecolor($NewWidth, $NewHeight); switch(strtolower(image_type_to_mime_type($type))) { case 'image/jpeg': case 'image/png': case 'image/gif': $NewImage = imagecreatefromjpeg($SrcImage); break; default: return false; } // Resize Image if(imagecopyresampled($NewCanves, $NewImage,0, 0, 0, 0, $NewWidth, $NewHeight, $iWidth, $iHeight)) { // copy file if(imagejpeg($NewCanves,$DestImage,$Quality)) { imagedestroy($NewCanves); return true; } } } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.