resize an image and upload it to server
7 1681 mwasif 802
Recognized Expert Contributor
Upload the image to server and resize it.
pbmods 5,821
Recognized Expert Expert
Heya, rinkudhimar.
Sure.
For $100.
Seriously now. You're going to have to give us more info than that.
Have you at least TRIED to implement it?
yes
the code is -
-
<?php
-
$userfile_name="image/terrest_gif.gif";
-
$add="e:/$userfile_name"; // the path with the file name where the file will be stored, upload is the directory name.
-
if(copy($userfile_name, $add)){
-
echo "Successfully uploaded the image";
-
chmod("$add",777);
-
}else
-
{
-
echo "Failed to upload file Contact Site admin to fix the problem";
-
exit;}
-
$n_width=100; // Fix the width of the thumb nail images
-
$n_height=100; // Fix the height of the thumb nail imaage
-
$tsrc="c:/$userfile_name"; // Path where thumb nail image will be stored
-
-
if (!($userfile_type =="image/pjpeg" OR $userfile_type=="image/terrest_gif.gif"))
-
{
-
echo "Your uploaded file must be of JPG or GIF. Other file types are not allowed<BR>";
-
exit;
-
}
-
-
if (@$userfile_type=="image/terrest_gif.gif"){
-
$im=ImageCreateFromGIF($add);
-
echo "$im";
-
$width=ImageSx($im);
-
echo "$width"; // Original picture width is stored
-
$height=ImageSy($im);
-
echo $height; // Original picture height is stored
-
$newimage=imagecreatetruecolor($n_width,$n_height);
-
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
-
-
if (function_exists("imagegif")) {
-
Header("Content-type: image/gif");
-
ImageGIF($newimage,$tsrc);
-
}
-
elseif (function_exists("imagejpeg")) {
-
Header("Content-type: image/jpeg");
-
ImageJPEG($newimage,$tsrc);
-
}
-
-
chmod("$tsrc",777);
-
if($userfile_type=="image/pjpeg"){
-
$im=ImageCreateFromJPEG($add);
-
$width=ImageSx($im); // Original picture width is stored
-
$height=ImageSy($im); // Original picture height is stored
-
$newimage=imagecreatetruecolor($n_width,$n_height);
-
imageCopyResized($newimage,$im,0,0,0,0,$n_width,$n_height,$width,$height);
-
ImageJpeg($newimage,$tsrc);
-
chmod("$tsrc",777);
-
}
-
}
-
?>
-
Heya, rinkudhimar.
Sure.
For $100.
Seriously now. You're going to have to give us more info than that.
Have you at least TRIED to implement it?
Format for the code tag is [code=language] [ / CODE]. not <code>. Full list of Code Tag Supported Languages
this forums awsome!! all i needed was a function to get image dimensions...go t a lot more than that....good work people
I am also expecting answers to my question and not such funny comments daily. I have sent the full code just because you get a detailed idea. Anyways I think that you cannot help at all.
code green 1,726
Recognized Expert Top Contributor
OK. Now we can see some code (difficult to read without tags!!) what is the problem?
ak1dnar 1,584
Recognized Expert Top Contributor
(difficult to read without tags!!)
Now It's ready to go.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Don |
last post by:
Does anyone know where I can find a client-side function I can reference from within an
HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it
on the client-side and not have to upload the large raw image to the server.
Thanks in advance for your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in...
|
by: Rudy |
last post by:
Hello all!
I been trying to get a handle with Images. I have learned alot from the fine
people here. So, I also learned that thumbnail images look terrible taken
from a digital cam. I know why they look bad. So what is the best way to
resize an image. I'm not too concerned about size, but I guess I would like
to compress it on the upload.
Any thoughts?
|
by: IkBenHet |
last post by:
Hello,
I use an ASP.NET script on my website to upload images (complete script
is listed at the end of this message).
Now, I want to limit the size (in width and height, but also in bytes).
For example, if the image is max. 400 pixel in height or max. 400 pixel
width or max. 100 Kb. The image is not uploaded. How can I do this?
Additionally, I also want to resize the images to a valid size when
|
by: David Lozzi |
last post by:
Howdy,
I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders!
Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
|
by: joe |
last post by:
Any articles relating with
Uploading images files to server and resize the image by asp.net 2.0
| |
by: Bob Bedford |
last post by:
Hi all,
I've a classic upload form where people may select images on their computer
to send on my website.
Since this is done by people not very confortable with computers, some sent
pictures are very huge (3MB) and I do resize them anyway since I only allow
500px wide pictures.
Instead of letting people upload the 3MB file then resize it on the server,
|
by: bungle |
last post by:
Hi
Would anyone be able to offer advice on how they would upload images
to SQL Server 2005 so that if they are too big the system will
automatically resize them first? Obviously you need to get hold of the
image first so do you store them to a temporary location first etc.???
This will be a web app.
Any advice/discussion would be very helpful.
|
by: Shawn Northrop |
last post by:
Ive been searching for an image resize tutorial for a while now and found this code which worked nicely. I was unable to find the full source code but i think i pieced together the code from the tutorials correctly. My problem is when i upload an image it does not fit any case in the open_image function switch statement.
when i echo $file i get 0808...tmp on my localhost server and 0808.... on my webhosting server. There is no .jpg even if...
|
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 = "photo/thumbs/"; // Path To Thumbnails Directory
$twidth = "125"; // Maximum Width For Thumbnail Images
|
by: pozze |
last post by:
Hi,
I've just made the change from ASP to .net.
I have a file (code below) that saves a user submitted file to a MS SQL 2005 database. It collects the file name, file size, file type, and lastly the binary data for the file.
I can sucessfully take the files out of the databse again and display them in a data grid.
I would like to resize the submitted file to a fixed size (say 180 x 120) before I upload it to the database and do this without...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |