That image is not broken

So that the image in the Web page is not broken
PHP function that provides easy to enlarge the image on the web with the image quality is similar to the original image. Other benefits also displays process the image faster than if we set width and height in html
Sometimes the display picture posted on our web is not uniform and broken when the size grew from the original image, we might want to display images on a web page with a larger size of the original image. Usually people do that in html tags set its width and height like this
[Image]
or set via css
[Image]width="200" heigth="200">
way that will cause the image that will appear to be broken on the web and automatically slow the process of loading a web page we

Php function that provides easy to enlarge the image on the web with the image quality is similar to the original image. Other benefits also displays process the image faster than if we set width and height in html. So there is no one we try to use the following trick,

Image.php example:

$ file = "file_namenya"; / / the image file name of a specific header ( 'Content-type: image / jpeg'); list ($ width, $ height) = getimagesize ($ file); / / retrieve width and height of the original image save in the variable $ width and $ height $ width_kanv = 300; / / width of image we desire $ height_kanv = 300; / / we desire a high image $ kanv = imagecreatetruecolor ($ width_kanv, $ height_kanv); $ image = imagecreatefromjpeg ($ file); imagecopyresampled ($ kanv, $ image, 0, 0, 0, 0, $ width_kanv, $ height_kanv, $ width, $ height); imagejpeg ($ kanv, ", 100); / / 100 is the image quality setting, that means 100% ?>

To use the script on a web page before, we live link input file that contains the script to the earlier image link in our web page. For example we save the script earlier in the file called imagefix.php. Save the file modifImage.php in the same folder with the images eg file2 image folder. To display the image we play live script
[Image].

For further modification, eg, we want the image displayed is not the same as the default image file specified in the variable $ file to the file modifImage.php. Do a little modification imagefix.php file

$ file = "file_namenya"; / / the image file name is changed to specific
$ file = $ _GET [ "file_name"];
width_kanv = $ 300 and $ height_kanv = 300; change into
$ width_kanv = $ _GET [ "width"]; change to $ height_kanv = $ _GET [ "high"];
After the file modifImage.php replaced, the image is ready for display. We can call the script
[Image] value of file_name, width, and height can be changed without changing modifImage.php need to edit the file again.
Congratulations Always Trying to Keep Learning and Learning
0 Responses