Jump to content

Search the Community

Showing results for tags 'image copy'.

  • 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 1 result

  1. Hi, I am getting an image URL from an xml feed. I am trying to copy the image from the URL in the XML Feed, then rename & resize it. Its only giving me a black resized block for each image resize... This is driving me nuts. Please look at my script and tell me where am I going wrong? set_time_limit(-1); $imgurl='http://path/to/img_main.jpg'; $pic=$imgurl; $img = $pic; //////// GET IMAGE NAME $url_arr = explode ('/', $pic); $ct = count($url_arr); $name = $url_arr[$ct-1]; $name_div = explode('.', $name); $ct_dot = count($name_div); $img_type = $name_div[$ct_dot -1]; /////// GET IMAGE NAME END $name= str_replace(' ', '_', $name); $im = imagecreatefromjpeg($img); $width = imagesx($im); $height = imagesy($im); $newwidth = '400'; $newheight = '240'; $thumb = imagecreatetruecolor($newwidth, $newheight); imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); imagejpeg($thumb,'../ad_images/'.$name); //save image as jpg echo '<img src="../ad_images/'.$name.'"> '; $newwidth1 = '130'; $newheight1 = '98'; $thumb1 = imagecreatetruecolor($newwidth1, $newheight1); imagecopyresized($thumb1, $im, 0, 0, 0, 0, $newwidth1, $newheight1, $width, $height); imagejpeg($thumb1,'../ad_images/130/'.$name); //save image as jpg echo '<img src="../ad_images/130/'.$name.'"> '; $newwidth2 = '65'; $newheight2 = '49'; $thumb2 = imagecreatetruecolor($newwidth2, $newheight2); imagecopyresized($thumb2, $im, 0, 0, 0, 0, $newwidth2, $newheight2, $width, $height); imagejpeg($thumb2,'../ad_images/65/'.$name); //save image as jpg echo '<img src="../ad_images/65/'.$name.'"> <br>'; $dbname=$name; imagedestroy($thumb); imagedestroy($thumb1); imagedestroy($thumb2); imagedestroy($im);
×
×
  • 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.