473,503 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

binary data manipulation

8 New Member
Hi All..

I am new to php programming. I know how to insert and delete images in database. But I would like to know how we can modify the existed image. i.e. already image is stored in databse. Now i have to change that image say for the same user. I have tried this with UPDATE. But its taking time to load new image. I have to refresh the page many times to display changed image.

Is there any other method to modify?

Thanking all


Shailaja
Nov 8 '07 #1
2 1565
r035198x
13,262 MVP
Hi All..

I am new to php programming. I know how to insert and delete images in database. But I would like to know how we can modify the existed image. i.e. already image is stored in databse. Now i have to change that image say for the same user. I have tried this with UPDATE. But its taking time to load new image. I have to refresh the page many times to display changed image.

Is there any other method to modify?

Thanking all


Shailaja
Perhaps the delay is something to do with the code you are using for the connection and the manner in which you are updating the image.
Without seeing the code no one can tell what the problem is, so post the code you are using.
Nov 8 '07 #2
shailajaAdiga
8 New Member
Perhaps the delay is something to do with the code you are using for the connection and the manner in which you are updating the image.
Without seeing the code no one can tell what the problem is, so post the code you are using.
Thank you for your reply...
......Here is the code to update image
Expand|Select|Wrap|Line Numbers
  1.     # change the image
  2.     if (isset($_POST['change_image'])){
  3.         $image_id = $_POST['image_id'];
  4.  
  5.         $imageUpload = $_FILES['image_2_upload']["tmp_name"];
  6.         $imageUpload_name = $_FILES['image_2_upload']['name'];
  7.         $imageUpload_type = $_FILES['image_2_upload']['type'];
  8.         $imageUpload_size = $_FILES['image_2_upload']['size'];
  9.  
  10.         # check file was uploaded via HTTP POST
  11.         if (is_uploaded_file($imageUpload)) { 
  12.             $imageHandle = fopen($imageUpload, "r");
  13.             $imageContent = fread($imageHandle, $imageUpload_size);
  14.             $imageContent = addslashes($imageContent);
  15.  
  16.             $sql = "UPDATE organization_logos SET  image = '{$imageContent}' ,image_type= '{$imageUpload_type}' WHERE image_id = '{$image_id}' ";
  17.             $result = mysql_query($sql) or die(mysql_error());
  18.             $num = mysql_affected_rows();
  19.             if ($num) {
  20.                 header ("Location: logo_actions.php?changed=yes&org_id={$org_id}");
  21.                }
  22.         } # end if (is_uploaded_file($imageUpload))
  23.         else {
  24.           header ("Location: logo_actions.php?changed=no&org_id={$org_id}");
  25.          }
  26.     } # end if (isset($_POST['change']))
  27.  
  28.  
  29. database connection..(include file)
  30.  
  31. <?php # Connections/web_user.php
  32. /* ---------------------------------------------------------------- */
  33. # general web user connection
  34.  
  35. /* ---------------------------------------------------------------- */
  36. $hostname = "localhost";
  37. $username = "webuser";
  38. $password = "sdg7234";
  39. $db_conn = mysql_connect($hostname, $username, $password) or die(error_message("dbconnect_error"));
  40. ?>
  41.  
In main file...
Expand|Select|Wrap|Line Numbers
  1. mysql_select_db('authentication');
  2.  
Thank you very much..
Nov 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6280
by: Ferran Foz | last post by:
Hello, I'm using ADODB.Stream to open a binary file on the server and write it down to the browser using Response.BinaryWrite. It's working fine, but i need to make some changes to the binary...
10
9077
by: J. Campbell | last post by:
OK...I'm in the process of learning C++. In my old (non-portable) programming days, I made use of binary files a lot...not worrying about endian issues. I'm starting to understand why C++ makes...
1
3457
by: rusttree | last post by:
I'm working on a program that manipulates bmp files. I know the offset location of each piece of relevent data within the bmp file. For example, I know the 18th through 21st byte is an integer...
3
2081
by: Josema | last post by:
Hi to all, I have stored in a database some binary files (pdfs, and gif images), i would like to know how could i show it, in internet explorer when a person enters for instance in a textbox the...
0
1831
by: AirYT | last post by:
Hello, Here's a quick explanation & problem: i have an ASP (iis v5.0) application that generates a pdf file and this file is saved to the server. it is saved in a location not available to web...
4
4197
by: Schwarty | last post by:
I hope I posted this to the correct group. If not, please let me know and I will get it posted in the correct section. I have a web application developed in ASP.NET using C# for the code behind....
3
3185
by: nguser3552 | last post by:
Hello Everyone, I have a problem I can't surmount, anything is gravy at this point. I need to be able to read any type of file .ext (mov,mpeg,mp3,etc) in binary format. I can do this in C, but ...
3
4856
by: tfeller | last post by:
I would like to drop the leading 0x on a binary value so I can do a bitwise operation. Here is simplified code: select right(0x88186000,8) I expected to get back 88186000, this was not the...
4
2507
by: freeurmind | last post by:
hello everybody, i'm trying to read binary data from an input file and store their bit by bit representation in an int array for further manipulation: - using the file.read(buffer,1) to retrieve my...
7
10580
by: azrael | last post by:
Hy folks, I googled, and searched, and can not bealive that I have not found a built in way to convert the easy and elegant python way a function to easily convert simple ascii data to binary...
0
7199
marktang
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,...
1
6984
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...
0
5576
agi2029
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,...
1
5005
isladogs
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...
0
4670
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...
0
3162
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...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
732
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
377
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.