PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old February 21st, 2003, 07:33 PM
tgavin tgavin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 tgavin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP-Ben Rowe's GD Ex.- need to insert into DB after upload

Noobe here,

Having a problem with inserting GD created images into the db.

My form will allow for multiple updates (one image at a time, or up to 5 at a time), so I can't hard-code any db field names into the action script, only the input form. After submission, the form redirects to self. The form will then show a thumbnail version of the image(s) and allow for the user to delete the image if/when desired.

The uploaded image is tracked by a hidden field "pic1" in the form.

I am using the GD library to resize the uploaded image, and then create a thumbnail. After which the script inserts the path to the thumbnail into the db.

Right now it's inserting the uploaded (large) image into field "pic1"

I would like to be able to insert the path of the generated thumbnail image into the db field "tnpic1".

The code I think in question is:
PHP Code:
// the name and path to the uploaded file  
 
$HTTP_POST_VARS[$tf] = $upload_path.$image_stored.$HTTP_POST_FILES['name']; 


$image_stored" is the large picture.

i know I can swap $image_stored for the thumbnail, but I still have the problem of the large image not being inserted. Either way, i need to get BOTH images into the db using $HTTP_POST_FILES.

How could I go about doing this?

if you need more information , please don't hesitate to ask!

The full PHP script is attached.

Thanks in advance
Attached Files
File Type: txt picture_upload.txt (3.9 KB, 465 views)

Last edited by tgavin : February 22nd, 2003 at 08:44 AM.

Reply With Quote
  #2  
Old February 23rd, 2003, 12:36 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
I'm confused... I'm looking in the script, but I don't see any INSERT statements for your db.

Also, what's the layout of the database table where you're inserting the details?
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #3  
Old February 23rd, 2003, 01:59 PM
tgavin tgavin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 tgavin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This is how the data is being inserted
PHP Code:
// the name and path to the uploaded file**
 
$HTTP_POST_VARS[$tf] = $upload_path.$image_stored.$HTTP_POST_FILES['name']; 

I have a hidden field in my form called "upload_path" with the value "photos/".

This script is working with Adobe GoLive to do the inserts - I think this is the problem. I would rather bypass GoLive (if I can) and just have the script insert the paths to both pictures into the fields "pic1" and "tnpic1".

The DB layout is basically:

userID int(11) unsigned NOT NULL auto_increment,
username varchar(25) NOT NULL default '',
pic1 varchar(100) NOT NULL default '',
tnpic1 varchar(100) NOT NULL default '',
PRIMARY KEY (userID),

Thanks!

Reply With Quote
  #4  
Old February 23rd, 2003, 02:23 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Quote:
Originally posted by tgavin
This is how the data is being inserted
PHP Code:
// the name and path to the uploaded file  
 
$HTTP_POST_VARS[$tf] = $upload_path.$image_stored.$HTTP_POST_FILES['name']; 

I have a hidden field in my form called "upload_path" with the value "photos/".

This script is working with Adobe GoLive to do the inserts - I think this is the problem. I would rather bypass GoLive (if I can) and just have the script insert the paths to both pictures into the fields "pic1" and "tnpic1".

The DB layout is basically:

userID int(11) unsigned NOT NULL auto_increment,
username varchar(25) NOT NULL default '',
pic1 varchar(100) NOT NULL default '',
tnpic1 varchar(100) NOT NULL default '',
PRIMARY KEY (userID),

Thanks!


Hmm... Not sure I understand still... Can GoLive actually perform DB inserts?

Maybe I'm overlooking something...

Reply With Quote
  #5  
Old February 23rd, 2003, 04:18 PM
tgavin tgavin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 tgavin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
GoLive can perform db inserts, updates, deletions... you name it, it can pretty much do it. It's a great tool. Of course at times it's limited.

Here's the form action:
Code:
<form action='../config/actions/mysql.actions6.php?<?php echo URLArgs(array())?>' method="post" name="picture_upload" enctype="multipart/form-data">
<input type="hidden" name="upload" value="now">
<input type="hidden" name="strWidth" value="100">
<input type="hidden" name="strHeight" value="100">
<input type="hidden" name="upload_path" value="photos/">
<input type="hidden" name='userID(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("userID")) ?>'>
<input type="hidden" name='pic1(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("pic1")) ?>'>
<input type="hidden" name='tnpic1(<?php echo $users->AbsolutePosition()?>)' value='<?php echo fixHTMLquotes($users->Value("tnpic1")) ?>'>
<input type="file" name="pic1" size="16"></div>
<a href='<?php echo mapPath($users->Value("pic1"), "../")?>' target="_blank">
<img src='<?php echo mapPath($users->Value("pic1"), "../")?>' alt="" height="75" width="100" border="1"></a>
<input type="checkbox" name="delete_pic[pic1]" value="pic1"> <b>Delete</b>
<input type="submit" value="Edit Picture 1" name="_SubmitChanges" <?php SetupMySQLUpdate("picture_uploadtest.php", '$return', $users) ?>>
<?php SetupMySQLForm($users); ?>
</form>


I attached the GoLive runtime library, in case you're curious.

I appreciate you taking a look at this!
Attached Files
File Type: txt mysql.runtime6.txt (18.5 KB, 353 views)

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP-Using Ben Rowe's GD Example-Insert after uploading


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway