Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How Does Uploading Pictures Work?


Like myspace how does it "upload" the images I got a form to give it a try but was wondering as I am using local host I want to test it by uploading to my own hard drive as such... but unfamiliar on 2 things...

1) where should it be stored in the htdocs directory precisely?

2) how do sites like myspace etc with hundreds of pictures on their server's know which image is related to which profile ?

Is it possible to test on local host? Or will i have to buy a real server firstly?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Uploading 2MB+ Pictures
I have a site that has a picture album. It is hosted and I believe the php.ini file is set at the default of 2MB limit per file.

With 5MP+ cameras out there many people have pictures that are over 2MB straight off the camera. As a convenience to the user, I would like to let them upload the pictures immediately after they pull them from the camera. I have the pictures resized to around 50k once they are on the server to conserve space and bandwidth.

Unfortunately, I can't even get the files over 2MB onto the server. As you know, many people are clueless about resizing their pictures and won't go to the trouble. I want them to be able to use my site. Does anyone have any good tricks to move 2MB+ files?

Uploading Pictures
I want to create a web site where the user uploads photos.

What is the proper way (I'm using php) to do this?

I want to make sure the user doesn't upload viruses instead of pictures.  Also want to be able to shape the pictures so that they are all the same size, no matter what size they are when the user uploads them.

Uploading Pictures
im trying to upload pictures but it does not record it in the database that a file has been attached for a particular bulletin.  Dont want to view it, just record that its been attached. Code:

Uploading Pictures In PHP/MySQL
Does anyone know of a good tutorial that works or some sample code that works for this function?

1. Load photo to a file folder on the server
2. Load photo name to the mysql database
3. Resize photo on upload to a specific size

I have found tutorials and sample code, but they don't work.

User Uploading Pictures
I have a web site I am developing, and have a question. I would like
members to be able to upload pictures.

Do you think they should be saved as individual files or should they be
put in an MySQL database? Which would you recommend, and do you have any
sample code for accomplishing this?

Uploading Files Doesn't Always Work
I have a website that lets users upload jpeg files. Some users upload fine but when others try they get a page full of warnings and lose the site. What would cause this?

Also, now when users are logging in they are logging into other users accounts but it was working fine 2 days ago. I haven't changed the script so why is this happening?

Uploading One File Works, But Uploading Two Results In 'Connection Interrupted'
I'm running PHP 5.2.3 via fastcgi. When I upload one file via a form,
it works perfectly. When I try to upload two files, however, I get the
'Connection Interrupted / The network link was interrupted while
negotiating a connection. Please try again.' message. The file sizes
aren't an issue as I checked the max post size, etc.

Anyone have any ideas what's wrong?

Uploading A Picture. Any Way To Validate Width Before Uploading?
I am using one of the tutorials to upload images. Because the images go into a template they must be a width of 300 pixels to look good. Is there anyway to validate the width of a .jpg, .png and .gif? Code:

PHP Seems To Work Half The Time, Phpinfo() Doesn't Work
I just updated from a phptriad installation of apache/php/mysql to manual installations of them, all the most current ones.

When I installed apache and php, things were fine. phpinfo loaded. After I installed mysql, things started messing up. I can connect to mysql so that seemed to go fine. But phpinfo wouldn't list MySQL info. So, I noticed I had the path to PHP in my httpd.conf wrong, I fixed it, restarted and thats when it all started.

I added the "php extension" line , enabled php_mysql.dll module, as well as putting libmysql.dll into my windows folder. Restarted the computer, and still problems.

What happens exactly is, if I go to my phpinfo.php page which has a simple phpinfo(); line...it doesn't show anything. If I View Source, I actually see the php code in notepad.
<? phpinfo(); ?>On other pages it prints some of the php code on screen. But on a few other pages, such as a page that creates and image via imagecreate()...it works.

Pictures In A DB
I am working on a website where people register to
model for photogrpahers. As they register, I want
them added to a list of other models, which will be
stored in a DB, and retrieved with PHP. I would like
to create a <table> setting, and have PHP list out
their names in alphabetical order.

My question is this. Do I put the pictures into the
DB (MySQL), or keep them in a separate directory? I
would then use a foreach statement to build the
<table> sequence and the rest of the page.

MB/KB Of Pictures
I have an image gallery and want to have a php script that shows how much MB/KB of pictures have been served that day. I am guessing that you just read how much a certain directory has been accessed and count that.

Downloading Pictures
I'm trying to download a gif image from the web and save to my servers hard drive. But I can't seem to fetch it correctly. I'm trying with.

Including Pictures Via PHP
Is there any way of including a jpg or gif file through php without using the code below?

<?php
include("/images/$id.jpg");
?>

Pictures From XML File.
I've been able to parse the XML files used to update my database.

Now, I receive image in XML files, like this:

<PICTURES COUNT="3" CDATA="1">
<PIC NR="1"><![CDATA[/9j/4AAQSkZJ.....=]]></PIC>
<PIC NR="2"><![CDATA[/9j/4AAQSk.............></PIC>
<PIC NR="3"><![CDATA[/9j/4AAQSk.............></PIC>
</PICTURES>

How to save those 3 images in 3 jpg files ?

Pictures In MySQL
I am creating a code out of bits and pieces I found in somebody else's
code, so I am not entirely sure how it behaves.

<IMG SRC="picture.php?ID=1029&THUMB=yes">

picture.php:
<?
Header( "Content-type: image/jpg");
$linkID = mysql_connect("host", "user", "password");
mysql_select_db("database", $linkID);
if(isset($_GET['ID'])){$ID=$_GET['ID'];}else{$ID=0;}
$result=mysql_query("SELECT * FROM picture_base WHERE ID=$ID") or
die("Can't perform Query");
$row=mysql_fetch_object($result);
if(isset( $_GET['THUMB']){echo $row->THUMB}else{echo $row->IMG;}
?>
The script works and displays pictures properly so I am happy with it.
Its small and simple enough, my question is if not every site is
saving their pictures in databases there must be a reason why, yes?
And if I load picture.php?ID=1029&THUMB=yes as opposed to picture.php?
ID=1029, will the script still load through the full sized image (in
the IMG collum) and will that effect my traffic?

Random Pictures
i want to display random pictures every time a page is loaded, but i dont want the same ones shown again. so I setup a database and a 20 year unique id cookie and i log the id's of the pics shown in the db. now the problem is, that i use mt_rand to generate an id and show that picture.

if the id has already been shown, by querying the db, what is the best way to get another random number that isn't in the db? do i have to do some kind of loop and getting generating random numbers until one isn't in the db yet? this might take a while if the user has almost seen all of them, it might take a while to get a random number that isn't one of the others.

Pictures In A News-site
I'm going to start a news-system. I planned the database, but I'm not sure how to place the images into a generated form.

The database (partial) is:

article_id int
author_id int
date date
title varchar (50)
body varchar --> here comes the html source
links, etc...

It is a good way to place the image path into the html (img src...) and store the images in a specified directory, or easier to place the binary file into the database (pgsql)??
what is better for the body, the article in a html file, and in the database only the link or the html source in the database.

Php Gallery For Pictures And Videos
I must create gallery (pictures and videos) in php The user must login to see only his personal files. There is any tool doing this....

Using Php Generated Pictures With HTML?
I am able to create images with the use of the GDLIB.
but I am not able to use these images together with HTML. I always get the
message "headers are already sent.

Pictures Into A MySQL Database
I need to put pictures in to a MySQL -database with PHP and also be able to view them on a web page with PHP.

Issue With Cache And Pictures
I have a problem with cached images...

The script first creates some pictures out of avariable source (every time
the script runs the pics are different):

$im = imagecreatefromjpeg($file);
imagejpeg($im2,"temp100.jpg",100);
imagejpeg($im2,"temp75.jpg",75);
imagejpeg($im2,"temp50.jpg",50);
imagejpeg($im2,"temp25.jpg",25);

then I show them using normal html img tags

<img src="temp100.jpg">

The problem is that the pictures are cached and the script/IE shows a
fautlhy version of the pictures.

I tried messing with the header as described in the php manual.

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

But this doesn't work... wrong pic-fileversion

Does anybody has a sollution?



How To Thumbnail 1000s Of Pictures
I have a directory on my box with over 1000 pictures on. Now i wanna make a thumbnail of every picture,I started out just programming away, got all the names of the ".jpg" into an array and then looped throug while using the "ImageCopyResized" function

first i got a timeout from the server saying ot took more than 30 secs to execute my script, then i used the "set_time_limit" function! But it still stops after having made about 50 thumbnails, i can't figure out whats wrong!! does anybody have any experience with this kind of operations??

Access Pictures From MySQL.
I'm planning on letting my users add pictures to their pages using the browser upload method. My question is, which is better? adding the picture to the database? or storing them on a separte directory and add a link to the page? I also will be letting each user have quota on the disk space.

Clicking Pictures To Appear In The Textarea.
I am trying to do a function where you click on the images and these are entered into the textarea. Exactly as if i was clicking on this above and it enters the code for the picture into this textarea.

Upload And Resize 2 Pictures
how can I upload and resize 2 or  more pict in same time:

if($_FILES["picture"]["name"][1]) {
      $dest = "../photo_dir/".$document_id."_photo[1].jpg";
      copy($_FILES["picture"]["tmp_name"][1], $dest);
}

if($_FILES["picture"]["name"][2]) {
      $dest = "../photo_dir/".$document_id."_photo[2].jpg";
      copy($_FILES["picture"]["tmp_name"][2], $dest);
}

... but I want to these pictures been resized from original size (no matter what size) on upload to x= 100px y=100px - or other dimension.

Reading Pictures In A Folder
I'm trying to make a simple way to make a dynamic photo gallery function.  This is my idea:
First have a folder called Pics, in pics is a folder for images of different type (the criteria fun,events,nature) then in there I dump the images sorted by types in there with a basic numbering scheme of 01.jpg,02.jpg,03.jpg,04.jpg.  Anyone got any ideas on a way I can read all the pictures in the subfolders and view them without having to give a count of images?

Load Multiple Pictures Into MySQL?
I'm trying to create a picture database for a site that I'm working on and I
would like to do the following:
- (main goal) Have a php script load an entire directory of photos into my
mysql database in one swoop.
- Display thumbnails on a general viewing page.
- allow for viewing individual pictures by clicking on the thumbnails.

<?php
error_reporting(E_ALL);
$id = $_REQUEST["iid"];
$link = mysql_connect("localhost", "root", "") or die("Could not connect:
" . mysql_error());

mysql_select_db("mysql") or die(mysql_error());
$sql = "SELECT b1 FROM t1 where id in (1,2,3)";

$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
header("Content-type: image/jpeg");

while ($row = mysql_fetch_array($result))
{
$fileContent = $row['b1'];

$im = imagecreatefromstring($fileContent);
$width = imagesx($im);
$height = imagesy($im);
$imgw = 50;
$imgh = $height / $width * $imgw;
$thumb = ImageCreate($imgw,$imgh);

ImageCopyResized($thumb,$im,0,0,0,0,$imgw,$imgh,Im ageSX($im),ImageSY($im));
ImagejpeG($thumb);

imagedestroy ($im);
imagedestroy ($thumb);
mysql_close ($link);
}
?>

It is only displaying one image.

Storing Pictures Generated Witn GD
I'm trying to make php store a picture (on the server) that have been resized by GD. The picture is downloaded from a browser. But I would like to store this file in different sizes. To save downloadtime and cpu-power I wish to do this only once while downloading the file to the server.I can resize files, but I'm unable to store them.

Read A Directory With 17'000 Pictures
I have the following problem with the simplified script bellow!
When I start this script the first time files (~17000) are read in the /camera25 directory in less then 5 sec. When I click again on the same camera button ( second from the left), or reload button on the browser, I get a timeout from provider....

Select Pictures And Show Selected
I need to make a webpage (php) where users can select some
excercises(with picture) out of 40, and then display a page with only
the selected excercises (with their picture) that you can print.

Showing Pictures From A Mysql Database
I am trying to get pictures out of my database, they are not actually pictures in the database, but I think just a reference to them. I will show in my code.
This is my PHP page I using to display them. Code:

Add 2-3 Pictures With Just 1 Article? (news- Publishing System)
Have a little problem here. I are about ot create an easy publishing system where the administrator can write down a happening, add some pictures and save it in a mysql db. I have created the article table, but my real problem is how to "connect" the pictures with the article?
what should i use to get them connected to just one article?

As a beginning i have this db:
id (unique and primary key i guess i should set this to)
when (the date event will happen)
added (date of when the news where added)
shortversion (a brief summary to use on the first page)
maintext (the article and rest of the text.)

then the problem:
how to include images with this?
1. little thumbnail to use on the first page (about 50*50xp) and then some pictures to use inside the article, larger around 150. From 0 to a 2-3 should be possible.

guess i should use a own table for the images, but how to link them with each other my head and I can just not understand så any help are appriciated !

Can't Delete Pictures From Server After I Upload With PHP Script
I am using a php script to allow people to upload images, but if I go onto the server later, I am unable to delete or rename the images.

Changing Pictures On Index-page When Reloading
I am a beginner but quite curious anyway.

My problem: I have seen websites that show different pictures whenever you enter the site. By doing this, the sites look always fresh and attractive and I like the idea a lot. Now I like to have the same function on my site but I do not know how that works...

Is there anybody who can give a good "explanation for dummies" on how to do that?

Upload And Resize Pictures With Path In Database
First I've must say Im completly new in php scripting

What I need to do is upload, resize pictures with path in database

Here is theory of it, and plan of doing it

Hope somebody can help me

here are 4 sizes of images:

- newimagename1_1 with size W=100 and H=67

- newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5,
newimagename6_6 with size W=308, H=208

- newimagename1 size W=308, H=208

- newimagename2, newimagename3, newimagename4, newimagename5, newimagename6
size W=500 and H=375

Code should go in this order:

- check if folder with name "ID_of_user" exists

- if it exists than upload images to it, if it doesn't then create it and
upload images

- array (image1, image2, image3, image4, image5, image6)

- foreach(array)

- if size of images are biger than W=500 and H=375 than resize them to W=500
and H=375m, if are not leave them as they are

- copy (resized) images to same users folder with name "newimagename.jpg"

- array (newimagename2, newimagename3, newimagename4, newimagename5,
newimagename6)

- for (newimagename1)

- resize newimagename1 to W=308, H=208

- copy newimagename1 to same users folder with new name
"newimagename1_1.jpg"

- resize "newimagename1_1.jpg" to W=100 and H=67

- foreach(array)

- resize array to W=150 and H=100 and copy them resized to same user folder
with name

"newimagename2_2, newimagename3_3, newimagename4_4, newimagename5_5,
newimagename6_6"

- conect to database

- insert into database path of images (image1, image2, image3, image4,
image5, image6, image7)

values (newimagename1_1, newimagename2_2, newimagename3_3, newimagename4_4,
newimagename5_5, newimagename6_6)

- Delete (image1, image2, image3, image4, image5, image6)

- Display images (newimagename1, newimagename2_2, newimagename3_3,
newimagename4_4, newimagename5_5, newimagename6_6)

with link to biger images (newimagename1, newimagename2, newimagename3,
newimagename4, newimagename5, newimagename6)

- Display image newimagename1_1

Using The Same Page To Display A Hundred Pictures One Picture At A Time
I have over a hundred pictures I would like to present.

Is it practical to create and parse an array of pictures,
picture paths, et al using server-side scripting to
accomplish this?

I created an array already, and whereby, the HTML and Javascript
currently used amount to about 14KB for each of four different
pages, the PHP page I started working on is already over 35KB in
size (most of it is server side processing creating the array of
pictures).

What I'd like to do, is load the array only one time, and keep that
loaded so the page doesn't recreate the array each time, thus
minimizing the server side array creation.

Also, I think I'm running into some problems whereby the
javascript is messing up Google's parsing of the page.

I don't see creating 100 different html pages as an answer,
in the respect if something ever changes, that's one big mess
to update and major portion of the content and alot of files.
Am I wrong in trying to avoid doing it via strictly HTML
pages?

The pages exist at, and they represent swimming pools designed
by the owner of Aquatic Creations (North Carolina In-Ground
Swimming Pool Designers):

Custom Swimming Pool Water Features
http://aquaticcreationsnc.com/lib/php/viewing0.php
Custom Designed Swimming Pools
http://aquaticcreationsnc.com/lib/php/viewing1.php
Custom Designed Spas
http://aquaticcreationsnc.com/lib/php/viewing2.php
Custom Swimming Pool Features
http://aquaticcreationsnc.com/lib/php/viewing3.php
Stone And Tile Around Swimming Pools
http://aquaticcreationsnc.com/lib/php/viewing4.php

Does anyone have any suggestions on how to accomplish such
or directions to pursue?

If you could take a look as well and provide comments on the
pages, I appreciate constructive criticism as well.

Quicker/easier/more Secure To Put Pictures In BLOB Fields In Mysql Or In A Directory?
I am researching the best place to put pictures. I have heard form both
sides and I'd like to know why one is better than the other.

Show Pictures With Correct Filename, Else "No Picture"
I want this script to get the pictures with the id of persons in a database, this works. But when there are no picture with correct id in the folder I want the script to show a "No picture"-picture, but this doesn´t work with this script. Why not? Code:

"Listing" Pictures From Folder
I have a pictures in one folder. Picture names is:

1_photo.jpg
2_photo.jpg
3_photo.jpg ... 100_photo.jpg ... and more

is there some posibility to list (print on screen) pictures without dbase. Mean to do one cycle (while), and list this pictures all, or with some limits.

Help With Uploading Via PHP
I'm having a problem with uploading via PHP. When I do the upload my script doesn't seem to get any info from the file. Code is as follows:

Uploading ???
Okay. I'm trying to figure out this...

I have a form that has the following:

- AgencyName (INPUT TEXT BOX for Agency's name)
- File (FILE FIELD)
- COMMENTS (TEXTAREA)

How would i go about making the file go into a specific directory and if the directory doesn't exist, create it. So for instance...

Uploading More Than One Pic
I am running a recipe site and am currently using the php script below to add recipes to the database.

It is currently able toupload one image per entry. I now wish to be able to have 2 images per entry.

Im not too sure how this can be done though, can anyone help?

Uploading A Pdf
I'm trying to upload a pdf file using the $_FILES built in array

It gets stalled at this point and displays the echo

if(!ereg("image",$_FILES['pix']['type']))
{
echo "<b>File is not a picture. Please try another
file.</b><br>";
include("illustup.inc");
exit();

This is the content of the $_FILES array
Array ( [name] => 000.pdf [type] => application/pdf [tmp_name] =>
C:PHPuploadtempphp2D.tmp [error] => 0 [size] => 26596 )

is it the 'type' thats wrong or the "image", I'm assuming I'm missing
something in the mime type.

If I try to load a gif file using the same script, it works fine.

Uploading
I have a folder called x-tract and in that folder i have a folder called
admin and music.
while in the admin folder i want to upload a file to the music file. i;ve
tried
copy($_FILES['musicfile']['tmp_name'],
"../music/".$_FILES['musicfile']['name']); ?> this does not work.
any ideas?

Uploading
How can i make a form which can be used to upload a file with php?

Uploading Via PHP
The place where I host my website gives me 7GB space total to use.
Normally, I also use this space to save files that I need to access
from several locations. The only way of uploading files is by ftp.

But now I want to use my space from a location that has blocked ftp.
This means that I can login via ftp, I can download, but I can't
upload.

Can't I install some php software on my site that will allow me to
upload files via a web interface? Preferably something that can upload
entire directory trees.

Uploading A Directory
It's very easy to upload a file using the post method with php. The user selects the file that he will upload and submits the form... What I want to do is uploading all the contents of a directory. The user will select a directory and all the files in that directory will be sent to the server. Is it possible to do this with php ? If so how ?

Uploading Directories ?
Is there any way I can simply allow a user to upload an entire directory through php without selecting the files one by one ?

Uploading Question
I have the following code which allows you to locate a file on your computer and upload it to a remote server. This works fine if the remote server is just another computer on my network, but I cannot get it to work for the remote server hosted by my ISP.


Copyright © 2005-08 www.BigResource.com, All rights reserved