resize an image and upload it to server
7 1665
Upload the image to server and resize it.
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...got 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.
OK. Now we can see some code (difficult to read without tags!!) what is the problem?
(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...
|
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...
|
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)....
|
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...
|
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...
|
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...
|
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...
|
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: 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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: 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...
| |