php-general Digest 31 Oct 2010 14:39:51 -0000 Issue 7014

Topics (messages 309157 through 309171):

Re: questions about if statements regarding a checkbox
        309157 by: Adam Richardson
        309158 by: admin.buskirkgraphics.com
        309159 by: Bastien
        309161 by: Ben Brentlinger
        309163 by: [email protected]
        309166 by: Andre Polykanine
        309168 by: Ben Brentlinger
        309171 by: admin.buskirkgraphics.com

include html
        309160 by: Karl DeSaulniers
        309165 by: [email protected]

search is not case insensitive
        309162 by: Dr Michael Daly
        309164 by: [email protected]
        309167 by: Dr Michael Daly

Re: Watermark with GD
        309169 by: Gary
        309170 by: Gary

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Sat, Oct 30, 2010 at 10:05 PM, Ben Brentlinger <[email protected]> wrote:
> hello,
>
> I'd like to know the proper code to use in a php script that processes a
> form with a checkbox in order to send one email if the checkbox has been
> checked and another email if the checkbox hasn't.  I tried if($check ==
> true) and I tried putting the word "true" in double quotes, and both of them
> caused the "unexpected variable" syntax error.  The only problem is, all I
> could think to use was that line of code I just used, I'm not sure what the
> proper syntax is for checkbox when using the if statement to send one email
> when the checkbox is checked and a different email when it's not checked.
>  I'm wanting to send an email to the site admin with the information given
> by the person who filled out the form that contains the checkbox.
>

// checkboxes are only set if checked
if (isset($_GET['checkbox_name'])) {
    // checkbox is checked, so send one mail
    mail($to = '[email protected]', $subject = 'Really cool email');
} else {
    // checkbox isn't checked, so send a different email
    mail($to = '[email protected]', $subject = 'Just as cool email');
}

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---

<input type=checkbox name=test>

If check it will submit the value of 'on'

So 

If($_POST['test'] == "on')
{
Do this
}else{
Do this
}


Richard L. Buskirk


-----Original Message-----
From: Ben Brentlinger [mailto:[email protected]] 
Sent: Saturday, October 30, 2010 10:05 PM
To: [email protected]
Subject: [PHP] questions about if statements regarding a checkbox

hello,

I'd like to know the proper code to use in a php script that processes a 
form with a checkbox in order to send one email if the checkbox has been 
checked and another email if the checkbox hasn't.  I tried if($check == 
true) and I tried putting the word "true" in double quotes, and both of 
them caused the "unexpected variable" syntax error.  The only problem 
is, all I could think to use was that line of code I just used, I'm not 
sure what the proper syntax is for checkbox when using the if statement 
to send one email when the checkbox is checked and a different email 
when it's not checked.  I'm wanting to send an email to the site admin 
with the information given by the person who filled out the form that 
contains the checkbox.


Thanks,

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---

On 2010-10-30, at 10:28 PM, <[email protected]> wrote:

> 
> 
> <input type=checkbox name=test>
> 
> If check it will submit the value of 'on'
> 
> So 
> 
> If($_POST['test'] == "on')
> {
> Do this
> }else{
> Do this
> }
> 
> 
> Richard L. Buskirk
> 
> 
> -----Original Message-----
> From: Ben Brentlinger [mailto:[email protected]] 
> Sent: Saturday, October 30, 2010 10:05 PM
> To: [email protected]
> Subject: [PHP] questions about if statements regarding a checkbox
> 
> hello,
> 
> I'd like to know the proper code to use in a php script that processes a 
> form with a checkbox in order to send one email if the checkbox has been 
> checked and another email if the checkbox hasn't.  I tried if($check == 
> true) and I tried putting the word "true" in double quotes, and both of 
> them caused the "unexpected variable" syntax error.  The only problem 
> is, all I could think to use was that line of code I just used, I'm not 
> sure what the proper syntax is for checkbox when using the if statement 
> to send one email when the checkbox is checked and a different email 
> when it's not checked.  I'm wanting to send an email to the site admin 
> with the information given by the person who filled out the form that 
> contains the checkbox.
> 
> 
> Thanks,
> 
> Ben
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

<input type=checkbox name=test value=1>
<input type=checkbox name=test value=2>
<input type=checkbox name=test value=3>

<?php

$Val=$_POST['test'];

switch($Val){
  case 1:
    // do something
    break;

  case 2:
    //do something else
    break;

  default:
     //another process

}



--- End Message ---
--- Begin Message --- I tried that, but I'm getting the syntax error that says "unexpected T_IF". Probably because I'm trying to process this information directly in an email rather letting a mysql database handle the data, which I find harder to set up when writing a script from scratch than it would be to code a php script to send the data in an email.

On 10/30/2010 22:28, [email protected] wrote:

<input type=checkbox name=test>

If check it will submit the value of 'on'

So

If($_POST['test'] == "on')
{
Do this
}else{
Do this
}


Richard L. Buskirk


-----Original Message-----
From: Ben Brentlinger [mailto:[email protected]]
Sent: Saturday, October 30, 2010 10:05 PM
To: [email protected]
Subject: [PHP] questions about if statements regarding a checkbox

hello,

I'd like to know the proper code to use in a php script that processes a
form with a checkbox in order to send one email if the checkbox has been
checked and another email if the checkbox hasn't.  I tried if($check ==
true) and I tried putting the word "true" in double quotes, and both of
them caused the "unexpected variable" syntax error.  The only problem
is, all I could think to use was that line of code I just used, I'm not
sure what the proper syntax is for checkbox when using the if statement
to send one email when the checkbox is checked and a different email
when it's not checked.  I'm wanting to send an email to the site admin
with the information given by the person who filled out the form that
contains the checkbox.


Thanks,

Ben


--- End Message ---
--- Begin Message ---
What is the code you're using now? You have a syntax error, but without seeing 
the code, we are all left to guessing what the problem could be.

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Ben Brentlinger" <[email protected]>
Date: Sun, Oct 31, 2010 03:56
Subject: [PHP] questions about if statements regarding a checkbox
To: <[email protected]>

I tried that, but I'm getting the syntax error that says "unexpected 
T_IF".  Probably because I'm trying to process this information directly 
in an email rather letting a mysql database handle the data, which I 
find harder to set up when writing a script from scratch than it would 
be to code a php script to send the data in an email.

On 10/30/2010 22:28, [email protected] wrote:
>
> <input type=checkbox name=test>
>
> If check it will submit the value of 'on'
>
> So
>
> If($_POST['test'] == "on')
> {
> Do this
> }else{
> Do this
> }
>
>
> Richard L. Buskirk
>
>
> -----Original Message-----
> From: Ben Brentlinger [mailto:[email protected]]
> Sent: Saturday, October 30, 2010 10:05 PM
> To: [email protected]
> Subject: [PHP] questions about if statements regarding a checkbox
>
> hello,
>
> I'd like to know the proper code to use in a php script that processes a
> form with a checkbox in order to send one email if the checkbox has been
> checked and another email if the checkbox hasn't.  I tried if($check ==
> true) and I tried putting the word "true" in double quotes, and both of
> them caused the "unexpected variable" syntax error.  The only problem
> is, all I could think to use was that line of code I just used, I'm not
> sure what the proper syntax is for checkbox when using the if statement
> to send one email when the checkbox is checked and a different email
> when it's not checked.  I'm wanting to send an email to the site admin
> with the information given by the person who filled out the form that
> contains the checkbox.
>
>
> Thanks,
>
> Ben
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hello Ben,

You should use isset:
if (isset($_POST['check'])) {
// The checkbox is checked
} else {
// It's unchecked
}

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

----- Original message -----
From: Ben Brentlinger <[email protected]>
To: [email protected] <[email protected]>
Date: Sunday, October 31, 2010, 4:05:06 AM
Subject: [PHP] questions about if statements regarding a checkbox

hello,

I'd like to know the proper code to use in a php script that processes a 
form with a checkbox in order to send one email if the checkbox has been 
checked and another email if the checkbox hasn't.  I tried if($check == 
true) and I tried putting the word "true" in double quotes, and both of 
them caused the "unexpected variable" syntax error.  The only problem 
is, all I could think to use was that line of code I just used, I'm not 
sure what the proper syntax is for checkbox when using the if statement 
to send one email when the checkbox is checked and a different email 
when it's not checked.  I'm wanting to send an email to the site admin 
with the information given by the person who filled out the form that 
contains the checkbox.


Thanks,

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message --- Here's the code I'm using with the exception of the php tags and the redirect script that redirects to another page once the form is submitted. This is just a test script I'm working on in order to teach myself php. The php portion will be posted first, than the html form related to the php. I've got the code inside tags similar to the "code" tag which only serves to serarate the php code from the html form.

[php_code]
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$email = $_POST['email'];

if($_POST['reallife'] == "on")
{
$to = '[email protected]';
$subject ='test email one';
$msg = "$name has filled out the test form. \n" .
"this is just a test message";
mail ($to, $subject, $msg, 'From:' . $email);

} else {

$to = '[email protected]';
$subject ='test email two';
$msg = "$name has filled out the test form." ;
mail ($to, $subject, $msg, 'From:' . $email);
}

if($_POST['reallife'] == "on") {

$to = '$email';
$subject = "Thank you email number one";
$msg = "hello $name, \n" .
"thank you for filling out the form. \n" .
"This is the first of two test emails \n" .
"The second would have been sent \n" .
"if you had left the checkbox unchecked \n";
mail ($to, $subject, $msg, 'From:' . [email protected]);
}

header ("location:thankyoupage")
[/php_code]



[html_code]
<div align="center">
<table border="0"
  cellpadding="3" cellspacing="0" width="59%">
<tr>
<td colspan="2">
<h2 align="center">&nbsp;</h2>
<h2 align="center"><font color="blue" face="Arial">Contact Form</font></h2>
<p align="center">&nbsp;</p>
<td width="51%" align="right">
<p align="left"><font face="Arial">Email</font><font face="Times New Roman">:</font><font face="Arial"> </font></td>
<td width="49%" align="left"><input type="text" name="email" size="20"></td>
</tr>

<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">First Name: </font></td>
<td width="49%" align="left"><input type="text" name="firstname" size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">Last Name: </font></td>
<td width="49%" align="left"><input type="text" name="lastname" size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">I know you in real life</font></td>
<td width="49%" align="left"><input type="checkbox" name="reallife" size="20"></td>
</tr>
</table>
<p><input type="submit" value="contact me"
  name="B1"></p>

</center></div>
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>
[/html_code]


This actual code that is on the portion of my hosting account which I use as my test server. In my opinion, it's much cheaper to pay for a hosting account to use as a test server to teach myself php than it is to pay some collage professor to teach it to you only to be slapped in the face by having him assume you're learning php to be a freelance coder working for a company that does freelance work. The truth is, I only have an interest in learning php to use in my own business and when I get good enough, I may do some freelancing on the side on sites like Scriptlance, but my main focus will be my own business and for anyone to have the audacity that I plan on working for someone else my whole life pisses me off, so that's why I'd much rather teach myself than to take a college class on php.

Thanks,

Ben

--- End Message ---
--- Begin Message ---
I tested your code and besides adding a form to the beginning it works.

If you want to see the results of the posted for try.

print_r($_POST);

you can see every position of the array passed and validate they are passing as 
intended.

Try this.

//if reallife is not set (Checked it will not pass)
// I am pretty sure I read where someone had responded with the isset


if(isset($_POST['reallife']))
{

print_r($_POST);

}



Richard L. Buskirk


-----Original Message-----
From: Ben Brentlinger [mailto:[email protected]] 
Sent: Sunday, October 31, 2010 8:26 AM
To: [email protected]
Subject: Re: [PHP] questions about if statements regarding a checkbox

Here's the code I'm using with the exception of the php tags and the 
redirect script that redirects to another page once the form is 
submitted.  This is just a test script I'm working on in order to teach 
myself php.  The php portion will be posted first, than the html form 
related to the php.  I've got the code inside tags similar to the "code" 
tag which only serves to serarate the php code from the html form.

[php_code]
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$email = $_POST['email'];

if($_POST['reallife'] == "on")
{
$to = '[email protected]';
$subject ='test email one';
$msg = "$name has filled out the test form. \n" .
"this is just a test message";
mail ($to, $subject, $msg, 'From:' . $email);

} else {

$to = '[email protected]';
$subject ='test email two';
$msg = "$name has filled out the test form." ;
mail ($to, $subject, $msg, 'From:' . $email);
}

if($_POST['reallife'] == "on") {

$to = '$email';
$subject = "Thank you email number one";
$msg = "hello $name, \n" .
"thank you for filling out the form. \n" .
"This is the first of two test emails \n" .
"The second would have been sent \n" .
"if you had left the checkbox unchecked \n";
mail ($to, $subject, $msg, 'From:' . [email protected]);
}

header ("location:thankyoupage")
[/php_code]



[html_code]
<div align="center">
<table border="0"
   cellpadding="3" cellspacing="0" width="59%">
<tr>
<td colspan="2">
<h2 align="center">&nbsp;</h2>
<h2 align="center"><font color="blue" face="Arial">Contact Form</font></h2>
<p align="center">&nbsp;</p>
<td width="51%" align="right">
<p align="left"><font face="Arial">Email</font><font face="Times New 
Roman">:</font><font face="Arial"> </font></td>
<td width="49%" align="left"><input type="text" name="email" size="20"></td>
</tr>

<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">First Name: </font></td>
<td width="49%" align="left"><input type="text" name="firstname" 
size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">Last Name: </font></td>
<td width="49%" align="left"><input type="text" name="lastname" 
size="20"></td>
</tr>
<tr>
<td width="51%" align="right">
<p align="left"><font face="Arial">I know you in real life</font></td>
<td width="49%" align="left"><input type="checkbox" name="reallife" 
size="20"></td>
</tr>
</table>
<p><input type="submit" value="contact me"
   name="B1"></p>

</center></div>
</form>
</td>
<td>&nbsp;</td>
</tr>
</table>
[/html_code]


This actual code that is on the portion of my hosting account which I 
use as my test server.  In my opinion, it's much cheaper to pay for a 
hosting account to use as a test server to teach myself php than it is 
to pay some collage professor to teach it to you only to be slapped in 
the face by having him assume you're learning php to be a freelance 
coder working for a company that does freelance work.  The truth is, I 
only have an interest in learning php to use in my own business and when 
I get good enough, I may do some freelancing on the side on sites like 
Scriptlance, but my main focus will be my own business and for anyone to 
have the audacity that I plan on working for someone else my whole life 
pisses me off, so that's why I'd much rather teach myself than to take a 
college class on php.

Thanks,

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Hello,
I am looking for a solution to inject some dynamic html into an iframe and rework the css from the results. Is there a way to do this in PHP? I am not talking about just using the src attribute of the iframe either.

Basically,
I want to call on a web page, grab the html code, replace the <link> tag with my own and insert it into an iframe on my page.

I am sure this is not as complicated as I am making it, but I have been trying with Ajax for the past couple of days and no luck. So I was wondering if there was a php alternative to do this with. Or if it is even possible or ok to do so.

I am building a website for a tshirt company that uses another company to get garments and promo items to print on. The client wants to just have those pages load on top of their website, but wants the layout to go with their look and feel. their css.
We have the go ahead from the other companies to do so as well.

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
This can only be done with javascript, as the iframe is client-side, which php 
knows nothing about.

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Karl DeSaulniers" <[email protected]>
Date: Sun, Oct 31, 2010 03:32
Subject: [PHP] include html
To: "php-general" <[email protected]>

Hello,
I am looking for a solution to inject some dynamic html into an  
iframe and rework the css from the results.
Is there a way to do this in PHP? I am not talking about just using  
the src attribute of the iframe either.

Basically,
I want to call on a web page, grab the html code, replace the <link>  
tag with my own and insert it into an iframe on my page.

I am sure this is not as complicated as I am making it, but I have  
been trying with Ajax for the past couple of days and no luck.
So I was wondering if there was a php alternative to do this with. Or  
if it is even possible or ok to do so.

I am building a website for a tshirt company that uses another  
company to get garments and promo items to print on.
The client wants to just have those pages load on top of their  
website, but wants the layout to go with their look and feel. their css.
We have the go ahead from the other companies to do so as well.

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Hi
Using a php search form produces a nil return on any information that is
capitalised within a mysql database; retrieval is fine for non-capitalised
data. Could someone tweak this please? The relevant code I think is as
follows:

// Description is a BLOB in MySQL... we need to UPPER the blob
//values to make the search case-insensitive.

        $query = "SELECT C.*, A.surname, A.name, A.surname_prefix, A.id AS user
FROM pbcs_user A, pbcs_join_table_user_app B, pbcs_appointment C        ".

                                "WHERE A.id = B.user_id AND B.appointment_id = 
C.id     ".

                                "AND LOWER(C.description) LIKE 
'%".strtolower($search_for)."%' AND
C.start_time > $start_time AND C.start_time < $end_time ORDER BY
C.start_time";
        $result = pbcs_db_query($query);

Thanks
Michael
Melb, Aust.

--- End Message ---
--- Begin Message ---
This isn't a php question but a mysql one. Take out the lower() part of the sql 
statement, as like is case insensitive by default.

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Dr Michael Daly" <[email protected]>
Date: Sun, Oct 31, 2010 04:47
Subject: [PHP] search is not case insensitive
To: <[email protected]>

Hi
Using a php search form produces a nil return on any information that is
capitalised within a mysql database; retrieval is fine for non-capitalised
data. Could someone tweak this please? The relevant code I think is as
follows:

// Description is a BLOB in MySQL... we need to UPPER the blob
//values to make the search case-insensitive.

        $query = "SELECT C.*, A.surname, A.name, A.surname_prefix, A.id AS user
FROM pbcs_user A, pbcs_join_table_user_app B, pbcs_appointment C        ".

                                "WHERE A.id = B.user_id AND B.appointment_id = 
C.id     ".

                                "AND LOWER(C.description) LIKE 
'%".strtolower($search_for)."%' AND
C.start_time > $start_time AND C.start_time < $end_time ORDER BY
C.start_time";
        $result = pbcs_db_query($query);

Thanks
Michael
Melb, Aust.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
thanks for this Ash...I didn't really understand but I do now!

unfortunately the fix didn't work, possibly bec the mysql data is in
binary format (default then becomes: case sensitive). I got a 'syntax
error' result

I'll find a mysql forum

Michael


This isn't a php question but a mysql one. Take out the lower() part of
the sql statement, as like is case insensitive by default.

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Dr Michael Daly" <[email protected]>
Date: Sun, Oct 31, 2010 04:47
Subject: [PHP] search is not case insensitive
To: <[email protected]>

Hi
Using a php search form produces a nil return on any information that is
capitalised within a mysql database; retrieval is fine for non-capitalised
data. Could someone tweak this please? The relevant code I think is as
follows:

// Description is a BLOB in MySQL... we need to UPPER the blob
//values to make the search case-insensitive.

        $query = "SELECT C.*, A.surname, A.name, A.surname_prefix, A.id AS user
FROM pbcs_user A, pbcs_join_table_user_app B, pbcs_appointment C        ".

                                "WHERE A.id = B.user_id AND B.appointment_id = 
C.id     ".

                                "AND LOWER(C.description) LIKE 
'%".strtolower($search_for)."%' AND
C.start_time > $start_time AND C.start_time < $end_time ORDER BY
C.start_time";
        $result = pbcs_db_query($query);

Thanks
Michael
Melb, Aust.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Dr Michael Daly MB, BS
GradDip(Integrative Medicine), GradCert(Evidence Based Practice),
M Bus(Information Innovation), GradDip(Document Management)
03 9521 0352
0413 879 029

--- End Message ---
--- Begin Message ---
"Tamara Temple" <[email protected]> wrote in message 
news:[email protected]...
>
> On Oct 30, 2010, at 9:31 AM, Gary wrote:
>
>>
>> "tedd" <[email protected]> wrote in message
>> news:p06240800c8f1d19b9...@[192.168.1.2]...
>>> At 3:05 PM -0400 10/29/10, Gary wrote:
>>>> I am trying to get the watermark to work, however I am having a 
>>>> problem in
>>>> that the image is being called from a database (image sits in images
>>>> file).
>>>>
>>>> The script in question is this
>>>>
>>>> $image = imagecreatefromjpeg($_GET['src']);
>>>>
>>>> However it produces an error message of
>>>>
>>>> Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 
>>>> Filename
>>>> cannot be empty in /home/content/a/l/i/alinde52/html/ imagesDetail.php 
>>>> on
>>>> line 233
>>>>
>>>> I have tried various methods, for example: ($_GET ['images/'] or 
>>>> ($_GET
>>>> ['images/$row_WADAimages["image_id"]].
>>>>
>>>> Can anyone shed some light on this for me.
>>>>
>>>> Thank you
>>>>
>>>> Gary
>>>
>>> Gary:
>>>
>>> Several things.
>>>
>>> 1. Getting an image from a database? You mean that you are getting  the
>>> path of the image in the file system, right?
>>>
>>> Side note: You could place the image inside the database using a  BLOB 
>>> and
>>> do away with the path all together. That has the benefit of being
>>> portable -- you simply move the database to where ever you want it.  The
>>> downside is that the database becomes very large, but no more so  that 
>>> the
>>> file system. There are pro's and con's in storing actual images in a
>>> database.
>>>
>>> 2. Using a GET is not the way to get the path. Instead, you have to
>>> retrieve the path from the database table where the path is stored --
>>> and that requires a MySQL query similar to "SELECT * FROM  <database> 
>>> WHERE
>>> id=<whatever>". There are lot's of examples of how to pull data  from a
>>> database.
>>>
>>> 3. After getting the path, then you can create the watermark like so:
>>>
>>> http://webbytedd.com/b/watermark/
>>>
>>> Hope this helps,
>>>
>>> tedd
>>>
>>> -- 
>>> -------
>>> http://sperling.com/
>>>
>>
>> tedd
>>
>> Thank you for your reply.
>>
>> I was under the impression that the image is stored in a folder called
>> images, in fact the images file do go in, however I have the DB set  up 
>> for
>> longblob, averaging about 20kb each, so now I am unsure.  I exported  the 
>> sql
>> so perhaps you can tell me.
>>
>> Table structure for table `images`
>> --
>>
>> CREATE TABLE IF NOT EXISTS `images` (
>>  `image_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
>>  `caption` varchar(50) NOT NULL,
>>  `wheretaken` varchar(100) NOT NULL,
>>  `description` text NOT NULL,
>>  `file_name` varchar(25) NOT NULL,
>>  `image_file` longblob NOT NULL,
>>  `submitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
>>  PRIMARY KEY (`image_id`)
>> ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1447 ;
>>
>> When I call the images, which works fine, I do need to specify the  path 
>> that
>> leads to the images folder. Am I being redundant in this structure.
>>
>> This is the script that I use to call the images. I have pulled out  some 
>> of
>> the html that styles the data.
>>
>> <?php if ($totalRows_WADAimages > 0) { // Show if recordset not  empty ?>
>>          <?php echo $row_WADAimages["caption"]; ?>
>>  src="images/<?php echo $row_WADAimages["image_file"]; ?>" <?php echo
>> $row_WADAimages["description"]; ?>"
>>
>> <?php echo $row_WADAimages["where_taken"]; ?>
>>        <?php echo $row_WADAimages["description"]; ?>
>>
>> Thank you for your help.
>>
>> Gary
>
> is this the imageDetail.php script?
>
> From what it appears in the code, `image_file` is holding the file  name 
> rather than the actual image. Yet you have `image_file` defined  as a 
> longblob, which would make sense if you were storing the actual  image 
> data in the data base rather than on the file system. As Ashley  noted, 
> you can do it either way. I notice you also have a field  `file_name` --  
> what is this used for? It sounds like your design is a  bit off -- neither 
> one way or the other. The php shown doesn't look  complete enough, 
> though -- where is the img tag and such? Also, going  in and out of php on 
> each line is kind of a waste and looks sloppy. If  i read that code right, 
> it would emit something like this:
>
>
> caption text
> src="images/pathtoimagefile" description text
>
> where taken text
> description text
>
> Look at the html that's emitted from the script and see if that's what 
> you get.
>
> Can you post or pastebin more of the .php script so I can see more of 
> what is going on?
>

Tamara

Thanks for the reply, here is a link to the code of the page.

http://www.paulgdesigns.com/detailcode.php

Again, thank you for your help.

Gary 



__________ Information from ESET Smart Security, version of virus signature 
database 5578 (20101031) __________

The message was checked by ESET Smart Security.

http://www.eset.com





--- End Message ---
--- Begin Message ---
Tamara

I realized I forgot to answer your question about file_name.  It is a text 
field that the photographer enters the name of the image file for easy 
reference.  He does not have access to the DB and he is inserting the images 
from a form I created.

I was sure that the images were being stored and called from the images 
folder and not directly from the DB, that is until tedd brought it up.  I 
did have an issue of getting the images to show in the beginning, however I 
solved it by inserting the path in the call from the DB.  I am wondering now 
if they are stored in both locations.

Thank again

Gary

"Tamara Temple" <[email protected]> wrote in message 
news:[email protected]...
>
> On Oct 30, 2010, at 9:31 AM, Gary wrote:
>
>>
>> "tedd" <[email protected]> wrote in message
>> news:p06240800c8f1d19b9...@[192.168.1.2]...
>>> At 3:05 PM -0400 10/29/10, Gary wrote:
>>>> I am trying to get the watermark to work, however I am having a 
>>>> problem in
>>>> that the image is being called from a database (image sits in images
>>>> file).
>>>>
>>>> The script in question is this
>>>>
>>>> $image = imagecreatefromjpeg($_GET['src']);
>>>>
>>>> However it produces an error message of
>>>>
>>>> Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: 
>>>> Filename
>>>> cannot be empty in /home/content/a/l/i/alinde52/html/ imagesDetail.php 
>>>> on
>>>> line 233
>>>>
>>>> I have tried various methods, for example: ($_GET ['images/'] or 
>>>> ($_GET
>>>> ['images/$row_WADAimages["image_id"]].
>>>>
>>>> Can anyone shed some light on this for me.
>>>>
>>>> Thank you
>>>>
>>>> Gary
>>>
>>> Gary:
>>>
>>> Several things.
>>>
>>> 1. Getting an image from a database? You mean that you are getting  the
>>> path of the image in the file system, right?
>>>
>>> Side note: You could place the image inside the database using a  BLOB 
>>> and
>>> do away with the path all together. That has the benefit of being
>>> portable -- you simply move the database to where ever you want it.  The
>>> downside is that the database becomes very large, but no more so  that 
>>> the
>>> file system. There are pro's and con's in storing actual images in a
>>> database.
>>>
>>> 2. Using a GET is not the way to get the path. Instead, you have to
>>> retrieve the path from the database table where the path is stored --
>>> and that requires a MySQL query similar to "SELECT * FROM  <database> 
>>> WHERE
>>> id=<whatever>". There are lot's of examples of how to pull data  from a
>>> database.
>>>
>>> 3. After getting the path, then you can create the watermark like so:
>>>
>>> http://webbytedd.com/b/watermark/
>>>
>>> Hope this helps,
>>>
>>> tedd
>>>
>>> -- 
>>> -------
>>> http://sperling.com/
>>>
>>
>> tedd
>>
>> Thank you for your reply.
>>
>> I was under the impression that the image is stored in a folder called
>> images, in fact the images file do go in, however I have the DB set  up 
>> for
>> longblob, averaging about 20kb each, so now I am unsure.  I exported  the 
>> sql
>> so perhaps you can tell me.
>>
>> Table structure for table `images`
>> --
>>
>> CREATE TABLE IF NOT EXISTS `images` (
>>  `image_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
>>  `caption` varchar(50) NOT NULL,
>>  `wheretaken` varchar(100) NOT NULL,
>>  `description` text NOT NULL,
>>  `file_name` varchar(25) NOT NULL,
>>  `image_file` longblob NOT NULL,
>>  `submitted` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
>>  PRIMARY KEY (`image_id`)
>> ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1447 ;
>>
>> When I call the images, which works fine, I do need to specify the  path 
>> that
>> leads to the images folder. Am I being redundant in this structure.
>>
>> This is the script that I use to call the images. I have pulled out  some 
>> of
>> the html that styles the data.
>>
>> <?php if ($totalRows_WADAimages > 0) { // Show if recordset not  empty ?>
>>          <?php echo $row_WADAimages["caption"]; ?>
>>  src="images/<?php echo $row_WADAimages["image_file"]; ?>" <?php echo
>> $row_WADAimages["description"]; ?>"
>>
>> <?php echo $row_WADAimages["where_taken"]; ?>
>>        <?php echo $row_WADAimages["description"]; ?>
>>
>> Thank you for your help.
>>
>> Gary
>
> is this the imageDetail.php script?
>
> From what it appears in the code, `image_file` is holding the file  name 
> rather than the actual image. Yet you have `image_file` defined  as a 
> longblob, which would make sense if you were storing the actual  image 
> data in the data base rather than on the file system. As Ashley  noted, 
> you can do it either way. I notice you also have a field  `file_name` --  
> what is this used for? It sounds like your design is a  bit off -- neither 
> one way or the other. The php shown doesn't look  complete enough, 
> though -- where is the img tag and such? Also, going  in and out of php on 
> each line is kind of a waste and looks sloppy. If  i read that code right, 
> it would emit something like this:
>
>
> caption text
> src="images/pathtoimagefile" description text
>
> where taken text
> description text
>
> Look at the html that's emitted from the script and see if that's what 
> you get.
>
> Can you post or pastebin more of the .php script so I can see more of 
> what is going on?
>
>
>
> __________ Information from ESET Smart Security, version of virus 
> signature database 5576 (20101029) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
> 



__________ Information from ESET Smart Security, version of virus signature 
database 5578 (20101031) __________

The message was checked by ESET Smart Security.

http://www.eset.com





--- End Message ---

Reply via email to