iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 16, 2008
Who Are Your Top Friends on Facebook?
About
 
May 15, 2008
Reader Question - Would you host your client's work on your website?
About
 
May 15, 2008
How to Create an Ajax Autocomplete Text Field: Part 6
WebReference.com
 
May 14, 2008
Poll: Are the browser safe colors still needed?
About
 
May 14, 2008
Google Doctype launched
About
 
May 14, 2008
Web Editor Reviews - 6 New Reviews
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /PHP

Storage and re-use of images using PHP/GD - Part 1 

  Views:    26391
  Votes:    3
by Gijs van Tulder 4/30/04 Rating: 

Synopsis:

In this article, we will write some scripts that automates the uploading, storage, converting and resizing of our images.
Pages: firstback1 2 3 4 6 7 forwardlast
The Article

The query

Using the data posted by the form, we can now build a search query. (We only search for width, height and bytes if a value is given.)

// build query
$query = "SELECT * FROM images WHERE ";

// title
$query .= "img_title LIKE '%".$HTTP_POST_VARS["title"]."%' AND ";

// description
$query .= "img_descr LIKE '%".$HTTP_POST_VARS["descr"]."%' AND ";

// alt
$query .= "img_alt LIKE '%".$HTTP_POST_VARS["alt"]."%' AND ";

// width
if (trim($HTTP_POST_VARS["width"])!="") {
    $query .= "img_width".$HTTP_POST_VARS["width_expr"].
               $HTTP_POST_VARS["width"]." AND ";
}

// height
if (trim($HTTP_POST_VARS["height"])!="") {
    $query .= "img_height".$HTTP_POST_VARS["height_expr"].
               $HTTP_POST_VARS["height"]." AND ";
}

// bytes
if (trim($HTTP_POST_VARS["bytes"])!="") {
    $query .= "img_bytes".$HTTP_POST_VARS["bytes_expr"].
               $HTTP_POST_VARS["bytes"]." AND ";
}

// type
$query .= "img_alt LIKE '%".$HTTP_POST_VARS["type"]."%' AND ";

// finish the query (we ended every part with AND)
$query .= "1";

Pages: firstback1 2 3 4 6 7 forwardlast

Similar/related articles:


 
  Sponsors