Thursday, 15 March 2012

html - Can't get image resize code to work in PHP -


I am creating a thumbnail system, but my code creates a bunch or random symbol It should work apparently, but it is not.

Code:

  & lt ;? Php // file $ filename = 'post / imgres / posts / 1 JPG'; // Maximum height and width $ width = 200; $ Height = 200; // Content Type Title ('Content-Type: Image / JP'); // Get a list of new dimensions ($ width_arbit, $ height_orig) = getimagesize ($ filename); $ Ratio_orig = $ width_orig / $ height_orig; If ($ width / $ height & gt; $ ratio_reference) {$ width = $ height * $ ratio_orig; } And {$ height = $ width / $ ratio_orig; } // Resample $ image_p = imagecreatetruecolor ($ width, $ height); $ Image = imagecreatefromjpeg ($ filename); Imagecopyresampled ($ image_p, $ image, 0, 0, 0, 0, width, $ height, $ width_core, $ height_orig); // Output Images ($ image_p, zero, 100); ? & Gt;  

I found a class named Satyam by Cloviska. And my code has now been done. This all looks like this.

The code that takes care of thumbnails:

  function is thumb ($ thumbnail) {if (file_exists ($ thumbnail)) {Back to true; }         return false; } Function methoshomb ($ origin, $ destination) {$ img = new abeautifulsite \ SimpleImage ($ original); $ Img- & gt; Fit_to_width (256); $ Img- & gt; ($ Destination); }? & Gt;  

Image that loads:

   & Lt; / A & gt; '; } Else {echo & lt; A href = "'. $ Image.'" & Gt; & Lt; Img src = "'. GetThumb ($ Image)." "/> Gt; & lt; / a & gt; ';}}} {// Write an error message to alert the user. The echo" & lt; P & gt; No image was found in the server. It is most likely that the PHP code has an error, is incompatible, or something went wrong with our storage solution. Contact the administrator: Required information: Browser, OS, and site worked before? & Lt; / P & gt; ";}? & Gt;  

No comments:

Post a Comment