Just wondering what is better, resizing an image from the previously used just one or uplaoding like a new correct size image. My site contains a great deal of images and smaller versions from the same images. We were wondering if the item slowed down or messed up world wide web browsers making the changes. Is them better to upload two images, one original your decide one modified I would burn up much more equipment space and time merely was going in order to upload two pictures. Its just a thought and We were wondering if anyone had an thoughts and opinions.
Better intended for what Speed a efficiency Then sure, if you will be serving up images who have not been size correctly or have not been optimized, then reuploading your corrected images would regularly be better.
You can even upload one full-size image so when that image gets
stored, a PHP script additionally creates a thumbnail of these image and
saves that in a different directory. That causes it to become easier to upload
images (you style do double work), as well as it’s faster when
the idea runs… to display the thumbnail as an alternative to resizing it every time.
This is certainly my favorite resize purpose…
Taken from the PHP. net handbook…
In such a example, it calls for the fullsize impression, resizes it to
the max width associated with 150 (you could specify that), and
saves that thumb in a different directory, yet using the
similar filename. So, you call this function immediately after you
save your full-size image.
< php
resize
("my_photo. jpg", 150, ". /thumbs/my_photo. jpg");
echo
"done";
function
resize($img, $thumb_width, $newfilename)
$max_width=$thumb_width;
//Check if GD extension is loaded
if (! extension_loaded('gd') & & ! extension_loaded('gd2'))
trigger_error("GD is not loaded", E_USER_WARNING);
return false;
//Get Image size info
list($width_orig, $height_orig, $image_type) = getimagesize($img);
switch ($image_type)
case 1: $im = imagecreatefromgif($img); crack;
case 2: $im = imagecreatefromjpeg($img); crack;
case 3: $im = imagecreatefrompng($img); crack;
default: trigger_error('Unsupported filetype! ', E_USER_WARNING); crack;
/*** calculate the aspect ratio ***/
$aspect_ratio = (float) $height_orig / $width_orig;
/*** calulate the thumbnail width based on the height ***/<br /