hi,
i've this situations where user will upload images..my code works fine for uploading images.. but i need to create auto thumbnail picture (of the same image) whenever user upload images... help me how to create thumbnail picture..
is my question clear?
thk in advance
5 2034 Motoma 3,237
Recognized Expert Specialist
You can use the height and width attributes of the <img> tag to adjust the size of the image.
hi,
i've this situations where user will upload images..my code works fine for uploading images.. but i need to create auto thumbnail picture (of the same image) whenever user upload images... help me how to create thumbnail picture..
is my question clear?
thk in advance
@ Motoma
here the page shows the all the images which user has uploaded, if i use the height and width to reduce the image display size, eventually the page will take much time to load...
hope i'm clear...
thkx for replying
Hi Deejam
In that case, you can as well write your own image resizing function. Not a big deal. Get the size of the image using the getimagesize function. Store the return values in a variable. Perform reduction on the width and the height returned by the getimagesize function and then return the new reduced width and heigth to the width and height parameters in the img tag.
More if you need help
Regards
CyberKing
Motoma 3,237
Recognized Expert Specialist
Cyberking's method is valid; if you want to do more research on this method, you should look up the PHP GD functions.
Thanks cyberking and Motoma...
here is the code for creating thumbnail to the uploading picture...
echo "Creating thumbnail for $filename <br />";
// Load image and get image size
$orgimg = imagecreatefromjpeg($filename);
$width = imagesx($orgimg);
$height = imagesy($orgimg);
// Setting new width and height for thumbnail size
$newwidth = 100; //any size as you wish
$newheight = floor($height*($newwidth/$width));
// Creating new temporary image
$tmpimg = imagecreatetruecolor($newwidth, $newheight);
// Copy and resize old image into new image
imagecopyresized($tmpimg, $orgimg, 0, 0, 0, 0, $newwidth, $newheight, $width, $height );
// Save thumbnail into a file
imagejpeg($tmpimg, $path_to_thumbs_dir.$filename);
i welcome any suggestion/correction...
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: DH |
last post by:
I have a "file upload form" that works OK, but I have been unsuccessful
in my attempt to also resize the uploaded .JPG (if it is too wide),
over-writing the original .JPG, and then create and save...
|
by: doffer |
last post by:
I want to make a portfoliosystem where user can register and get their
own portfolio... I've started the developer work, but I'm stuck on the
image upload part... I'm experiencing some problems...
|
by: Faree |
last post by:
Hi,
I am a PHP Developer.can any one help me on image upload and
display of that image.what i want is uploading an image to a
directory ,displaying of that image as a thumbnail.when i...
|
by: Duncan Welch |
last post by:
I've got users uploading a file, which I then want resize, make a thumbnail
out of, then delete. The image and thumbnail are working fine, but when I
try to delete the image, I get an error: "The...
|
by: Neo Geshel |
last post by:
I have examined about 80+ different upload scripts on the 'net, both in
VB and C#, and none seem to do what I need them to do. Perhaps someone
here can point me somewhere that Google hasn't...
| |
by: hannes |
last post by:
I have a problem with uploading images and creating thumbs from it.
Not all the time, but sometimes, the full size image is completely
uploaded and correct, while the thumbnail only builds a...
|
by: xx75vulcan |
last post by:
Hi,
I've got a PHP Upload Form that works great, unless that is, the image
your uploading has been modified through a photo editing software.
Example: if I upload the image straight from a...
|
by: mishrarajesh44 |
last post by:
hii all
Truly telling i hav got this code from net &
i am finding error while running the code below..
code:-
<?php
$idir = "photo/"; // Path To Images Directory
$tdir =...
|
by: mishrarajesh44 |
last post by:
hii all,
I am facing a problem currently..
i have a script for image uploading and resizing..
the image uploading takes place properly for every size images..
but, the resizing works for...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |