php-general Digest 19 Sep 2010 22:00:55 -0000 Issue 6949

Topics (messages 308189 through 308198):

Re: 1984 (Big Brother)
        308189 by: tedd

Re: Checking file type when uploading
        308190 by: tedd

Re: GD Watermark Question
        308191 by: tedd
        308196 by: Peter Lind

Re: GD Watermark Question-
        308192 by: tedd
        308193 by: tedd
        308194 by: tedd
        308195 by: tedd
        308197 by: TR Shaw

PHP Email Question
        308198 by: Joe Jackson

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 ---
At 12:03 PM -0400 9/18/10, chris h wrote:

But Tedd, I'm still thinking that a "dead man's switch" is the way to go.
 :)

Chris et al:

I think the method I'll recommend to the client is to have the entire office tied to his computer. When it's on, everything is up and when it's off, everything is down

That way if the client wants to leave (lunch, bathroom, whatever), he can turn his computer off, or leave it on -- as he wants.

If he doesn't show up for work (vacation, sick, whatever), he can tell a subordinate to turn his computer on, or not -- it's totally his choice.

The beauty of this method is that it is very simple to understand. There's nothing complicated about it.

As I tell my grand-kids "Half the people you meet everyday are below average intelligence -- plan for it". There's nothing elitist about my statement, but rather a statement of fact. I often over estimate the understanding of clients and as I get older I see the error in my ways.

Program for excellence, but design for stupidity.

Thanks to all.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 1:40 PM -0700 9/17/10, Catherine Madsen wrote:
Hi!

I have created a form following the PHP manual to upload files and need
to restrict the upload to only PDF.  How do I check the file type
($_FILES['userfile']['type']?) and where: on the form page or on the
validation page?  I want to be able to tell the users that their file
doesn't have the right format.  Thank you very much for your help!
-snip-
Catherine

Catherine:

Two things:

First, you can't do anything to the file before you upload it. You must have the file before you can test it.

Second, extensions can be bogus.

As such, I would recommend examining the contents of the file after it has been uploaded. For example, if you examine a pdf file you will find that most have "PDF" appearing within the first four bytes. Likewise, jpeg files have "JFIF" appearing within the first 10 bytes and gifs have "GIF" appearing as the first three bytes. Most files have some indication of what they are in their headers.

Now, this does not mean that the file having the proper header identification is guaranteed to be not something else, because it can be something else. I have an example of a PNG file that is a javascript script that can be run by simply loading it. It's very interesting.

The programmer used a PNG generator to reduce the size of his script to get it under the weight (size) restrictions of a contest. Very imaginative, but it shows that sometimes things are not what they claim to be.

Cheers,

tedd
--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 6:03 PM -0400 9/17/10, Gary wrote:
Is there a way to insert a watermark on an image as it is being uploaded to
the image file, then removed when it is called from a database to be viewed
on a website?

The rational behind this is I have a photographers site I am doing, and I am
limiting the size of the images somewhat to reduce pilferage and I would
like to be able to show the images a little larger, hence with a bit more
clarity and detail.

Thanks for your input.

Gary

Gary:

Don't complicate this process more than necessary.

Simply upload the image file normally and store it in the file system OR the database.

When you want to show the image as a thumbnail, then show it. Here's the code:

http://webbytedd.com/b/thumb/

If you want to show it with a watermark, then show that. Again, here's the code:

http://webbytedd.com/b/watermark/

If you want to show the image as a thumbnail with a watermark, then combine the two routines. I'll leave that to you.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
On 19 September 2010 16:05, tedd <[email protected]> wrote:
> At 6:03 PM -0400 9/17/10, Gary wrote:
>>
>> Is there a way to insert a watermark on an image as it is being uploaded
>> to
>> the image file, then removed when it is called from a database to be
>> viewed
>> on a website?
>>
>> The rational behind this is I have a photographers site I am doing, and I
>> am
>> limiting the size of the images somewhat to reduce pilferage and I would
>> like to be able to show the images a little larger, hence with a bit more
>> clarity and detail.
>>
>> Thanks for your input.
>>
>> Gary
>
> Gary:
>
> Don't complicate this process more than necessary.
>
> Simply upload the image file normally and store it in the file system OR the
> database.
>
> When you want to show the image as a thumbnail, then show it. Here's the
> code:
>
> http://webbytedd.com/b/thumb/
>
> If you want to show it with a watermark, then show that. Again, here's the
> code:
>
> http://webbytedd.com/b/watermark/
>
> If you want to show the image as a thumbnail with a watermark, then combine
> the two routines. I'll leave that to you.
>

You're generating the thumbnail on every request. Just generate it
once and serve the thumbnail as a file (there's no reason why you
would need to invoke php to show a thumbnail of an image).
Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
BeWelcome/Couchsurfing: Fake51
Twitter: http://twitter.com/kafe15
</hype>

--- End Message ---
--- Begin Message ---
At 6:21 PM -0400 9/17/10, Gary wrote:
""Gary"" <[email protected]> wrote in message
news:[email protected]...
 Is there a way to insert a watermark on an image as it is being uploaded
 to the image file, then removed when it is called from a database to be
 viewed on a website?

 The rational behind this is I have a photographers site I am doing, and I
 am limiting the size of the images somewhat to reduce pilferage and I
 would like to be able to show the images a little larger, hence with a bit
 more clarity and detail.

 > Thanks for your input.


Gary:

When the user see's an image in their browser they *have* downloaded it.

You cannot show them an image without a watermark and then somehow prohibit them from downloading the image. When you show it, you've lost control.

My advice, show them an image with a watermark and only allow them to see an image without the watermark when you want them to see it -- in other words, protect the image.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 6:56 PM -0400 9/17/10, TR Shaw wrote:
On Sep 17, 2010, at 6:49 PM, Ashley Sheridan wrote:

 > At the end of the day, if you want to prevent people downloading your
 images, then just don't show them the image.

Actually you can. Serve up an image from the DB and add watermark or whatever on the fly for web browsers. If a user downloads (assuming that s/he bought the image or the image is a "freebie" ) the image comes from the DB directly to the user using download headers.

Tom

Actually you can't.

Regardless of where the image comes from (DB or file), when the user see's the image, they have it.

Cheers,

tedd
--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 12:36 AM +0100 9/18/10, Ashley Sheridan wrote:

I know this is getting a little off-topic here, but surely the way a
jpeg destroys data in an image would destroy the stenography information
too? To the human eye all would appear normal, but the copyright info
would be lost?

I don't know much about this sort of thing, so I'm making assumptions
here.


It's the difference between lossless and lossy compression. The first meaning no loss in data and the second is loss of data. PNG and jpeg is lossless whereas gif is lossy.

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
At 7:56 PM -0400 9/17/10, TR Shaw wrote:

Nevertheless, I say again the key is to add something is that if an employee of a customer who purchases the image and resells it that you have a possibility to prove. Yes really smart bad people can defeat but 1) most of these aren't stealing your pictures and 2) the others don't know you have embedded a copyright.

tom


While it won't defeat smart bad people, it will cause them to pause:

http://webbytedd.com/b/protect-image/

Cheers,

tedd

--
-------
http://sperling.com/

--- End Message ---
--- Begin Message ---
On Sep 19, 2010, at 11:50 AM, tedd wrote:

> At 12:36 AM +0100 9/18/10, Ashley Sheridan wrote:
>> 
>> I know this is getting a little off-topic here, but surely the way a
>> jpeg destroys data in an image would destroy the stenography information
>> too? To the human eye all would appear normal, but the copyright info
>> would be lost?
>> 
>> I don't know much about this sort of thing, so I'm making assumptions
>> here.
> 
> 
> It's the difference between lossless and lossy compression. The first meaning 
> no loss in data and the second is loss of data. PNG and jpeg is lossless 
> whereas gif is lossy.


Actually GIF is lossless (it uses LZW encoding) PNG is also lossless (Ii uses 
DEFLATE).  The specification for JPEG supports both lossy and lossless. And 
then, of course there is wavelet used in JPEG2000 and other wavelets  These are 
lossy.

Tom

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

Sorry for the simple question but I am trying to get my head around PHP.  I
have a sample PHP script that I am trying to use to send a php powered email
message.  The snippet of code is shown below....

    mail('[email protected]', 'Subject', $values['message'], "From:
\"{$values['name']}\" <{$values['emailaddress']}>");

This works fine, but how can I add in other fields to the email that is
recieved?

For example in the form there are fields called, 'emailaddress',
'telephone', 'address' and 'name' which I need to add into the form along
with the message field

Also with the formatting how can I change the format of the email to

Name: $values['name'],
Address: etc
Message:

TIA

--- End Message ---

Reply via email to