473,656 Members | 2,756 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 1572
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
6297
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 data before it is send to the browser. I'm trying to use REPLACE, but it's not finding a string that i know it's in the binary file. Using InstrB i've found that the search inside the binary data is being done in a Unicode format, but i don't
10
9106
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 it difficult to read/write an integer directly as a bit-stream to a file. However, I'm at a bit of a loss for how to do the following. So as not to obfuscate the issue, I won't show what I've been attempting ;-) What I want to do is the...
1
3469
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 value representing the width of the bmp image. So far, I have been able to use fstream's seek, write, and read to pull out chucks of bytes and convert them to usable integers straight out of the binary file. It works well, but over the course of...
3
2092
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 id of the file that want to view.... This is my Sql table... ID int File binary
0
1848
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 users. i have an asp script (below) that sends the pdf file to the user as a binary stream. So that the user specifies which file to upload, the script performs some security checking and if it passes, it sends the pdf document.
4
4222
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. I need to be able to print shipping labels from a web page within this application. The shipping label data is pulled from a 3rd party application and comes in binary format specific for certain brands of label printers. I have a class library...
3
3190
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 have to use: int main(int argc,char** argv) which is archaic. My compiler is Visual Studio 5.0 Pro. To make my dilemma as clear as possible:
3
4861
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 case. The command returned some wierd characters.
4
2521
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 first byte of data - using unsigned char mask (for ex 0x80 = 1000 0000) i'm trying to AND it with my buffer in order to get my MSB, but i dont know how to retrieve the remaining bits. On the other hand my buffer type should it be char or unsigned...
7
10584
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 and back. I've written some my own but they were pretty slow using binascii linbrary with hexifly and unhexifly functions conbined with a lookuptable of binary and hex values.
0
8297
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
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...
0
8717
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8498
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,...
0
8600
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4150
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...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1600
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.