php-general Digest 21 Nov 2007 12:39:37 -0000 Issue 5140

Topics (messages 264887 through 264901):

Should I put pictures into a database?
        264887 by: Ronald Wiplinger
        264888 by: Bastien Koert
        264893 by: Børge Holen
        264894 by: Jonas Geiregat

Basic question - PHP usage of SVG files
        264889 by: Dave M G
        264890 by: Casey

Re: __sleep() strange behavior with file writting and SESSION using
        264891 by: Julien Pauli
        264892 by: chetan rane
        264896 by: Zoltán Németh
        264899 by: Jochem Maas

Re: Basic question - PHP usage of SVG files [SOLVED]
        264895 by: Dave M G

Re: Sending Pictures to Cell Phones
        264897 by: Jeffrey

uploading files... necessary Ajax?
        264898 by: pere roca
        264900 by: Christian Hänsel

PHP + Amazon to retrieve book data
        264901 by: Scott Wilcox

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 ---
I have an application, where I use pictures. The size of the picture is
about 90kB and to speed up the preview, I made a thumbnail of each
picture which is about 2.5 to 5kB.
I use now a directory structure of   ../$a/$b/$c/<pictures>

I wonder if it would be good to put the thumbnails into the current
table, in a different table or leave it like it is now. Same for the
pictures.

What is your opinion and why?

bye

Ronald

--- End Message ---
--- Begin Message ---
Well, this was just hashed out last week, again. 
 
Its a personal thing. I am against it, having seen the slowdown and database 
bloat caused when this is done. I prefer a pointer to the image to be stored in 
the table and use that. I have found that after about 12Gb of binary data gets 
into the table, it really starts to affect perfomance (in mysql).
 
The arguments for storing the image:
- automatically backed up with the db (you do back up, right?)
- stored with the relevant backing data
 
Against:
- more complex to show image
- db bloat (size of db balloons, may affect cost of storage)
- performance slowdowns as image data grows
 
regards,
 
bastien> Date: Wed, 21 Nov 2007 10:14:43 +0800> From: [EMAIL PROTECTED]> To: 
[EMAIL PROTECTED]> Subject: [PHP] Should I put pictures into a database?> > I 
have an application, where I use pictures. The size of the picture is> about 
90kB and to speed up the preview, I made a thumbnail of each> picture which is 
about 2.5 to 5kB.> I use now a directory structure of ../$a/$b/$c/<pictures>> > 
I wonder if it would be good to put the thumbnails into the current> table, in 
a different table or leave it like it is now. Same for the> pictures.> > What 
is your opinion and why?> > bye> > Ronald> > -- > PHP General Mailing List 
(http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> 
_________________________________________________________________
Send a smile, make someone laugh, have some fun! Start now!
http://www.freemessengeremoticons.ca/?icid=EMENCA122

--- End Message ---
--- Begin Message ---
On Wednesday 21 November 2007 03:14:43 Ronald Wiplinger wrote:
> I have an application, where I use pictures. The size of the picture is
> about 90kB and to speed up the preview, I made a thumbnail of each
> picture which is about 2.5 to 5kB.
> I use now a directory structure of   ../$a/$b/$c/<pictures>
>
> I wonder if it would be good to put the thumbnails into the current
> table, in a different table or leave it like it is now. Same for the
> pictures.
>
> What is your opinion and why?

Ouch this particular piece of topic is a all time champion of things to 
discuss... 
Richard Lynch is pretty good at beating that old horse ;D (you there?)

I would say it's up to you and the project...
I've made a couple of pedigrees and membership lists where I've chosen to put 
images in the database for the reason of simplicity.
10.000 small images really gets me depressed when viewed as files.

_I_ feel that a list of ... lets say 250 employees is far more compact and 
corrrect in a blob; small program and everything piled in one place. 
The previous mailer talked about huge blob data, mine will never come close 
12gb of blob data.

I've made a couple of forums where multiple image uploading and expanding 
possibilities made it awkward to use blobs.

As I said, if youre comfortable with using files in a blob rather than remote 
filesystem, and the project works OK with it, why not.
On the other hand, none've my tables passed 1gb yet.
>
> bye
>
> Ronald



-- 
---
Børge Holen
http://www.arivene.net

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

Op 21-nov-07, om 03:45 heeft Bastien Koert het volgende geschreven:


Well, this was just hashed out last week, again.

Its a personal thing. I am against it, having seen the slowdown and database bloat caused when this is done. I prefer a pointer to the image to be stored in the table and use that. I have found that after about 12Gb of binary data gets into the table, it really starts to affect perfomance (in mysql).

Using a pointer just makes more sense to me.

The arguments for storing the image:
- automatically backed up with the db (you do back up, right?)
- stored with the relevant backing data

Against:
- more complex to show image
- db bloat (size of db balloons, may affect cost of storage)
- performance slowdowns as image data grows

regards,

bastien> Date: Wed, 21 Nov 2007 10:14:43 +0800> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]> Subject: [PHP] Should I put pictures into a database?> > I have an application, where I use pictures. The size of the picture is> about 90kB and to speed up the preview, I made a thumbnail of each> picture which is about 2.5 to 5kB.> I use now a directory structure of ../$a/$b/$c/ <pictures>> > I wonder if it would be good to put the thumbnails into the current> table, in a different table or leave it like it is now. Same for the> pictures.> > What is your opinion and why?> > bye> > Ronald> > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php>
_________________________________________________________________
Send a smile, make someone laugh, have some fun! Start now!
http://www.freemessengeremoticons.ca/?icid=EMENCA122

--- End Message ---
--- Begin Message ---
PHP list,

I have some images that are in SVG format. What I want to do with them is manipulate them by resizing and overlaying one on top of the other.

I do this frequently with PNG images, and I could first convert these images to PNG before manipulating them in PHP.

However, I'd like to preserve line quality by keeping them as SVG until the last moment.

I can't see on the online documentation if SVG is supported and if it requires different commands than raster image formats.

What is the support for SVG in PHP, and where is the online documentation for it?

Thank you for your help.

--
Dave M G

--- End Message ---
--- Begin Message ---
On Nov 20, 2007 7:24 PM, Dave M G <[EMAIL PROTECTED]> wrote:
> PHP list,
>
> I have some images that are in SVG format. What I want to do with them
> is manipulate them by resizing and overlaying one on top of the other.
>
> I do this frequently with PNG images, and I could first convert these
> images to PNG before manipulating them in PHP.
>
> However, I'd like to preserve line quality by keeping them as SVG until
> the last moment.
>
> I can't see on the online documentation if SVG is supported and if it
> requires different commands than raster image formats.
>
> What is the support for SVG in PHP, and where is the online
> documentation for it?
>
> Thank you for your help.
>
> --
> Dave M G
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

There is no SVG support in PHP, as far as I know. However, since SVG's
are XML's, you could extract the contents of <svg> in both files and
merge them together.

-Casey

--- End Message ---
--- Begin Message ---
Okay, I understand that, thanks all for your help.
I'am used to always using an absolute path, I don't know why this time I
didn't use one.
By the way, that was interesting to understand the "underground" php
behavior.



2007/11/21, Jochem Maas <[EMAIL PROTECTED]>:
>
> Andrés Robinet wrote:
> >> -----Original Message-----
>
> ...
>
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > Just wanted to add, I found a log.txt at "D:\xampp\apache" which happens
> to
> > be the root of the apache installation on my system... so, moral of the
> > story, the current dir is not always the script's dir.
> > dirname(__FILE__)."/log.txt" will do the trick.
>
> I was stumped when originally reading your question. I guess I glossed
> over the fact that you weren't using an absolute path for the log file.
>
> the problem makes sense - the CWD is the directory of the script that was
> called,
> but during the startup/shutdown phases of php there is no script, the CWD
> is then
> whatever the CWD is of the process that started php - apache in this case.
> additionally
> some code may change the CWD and there maybe countless of other factors
> that could effect
> it.
>
> I suggest always using absolute paths - of only to avoid little
> mind-benders like this.
>
> :-)
>
> >
> > Rob
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Sorry Buddie But Session dose not serialize the Object Please Have a look at
the Code Again I have tried it with PHP 5.2
IT dose not call __sleep function. only when you have serialize it calls it.


On Nov 21, 2007 3:23 AM, Julien Pauli <[EMAIL PROTECTED]> wrote:

> Sorry but it goes throught __sleep() as session serializes objects before
> storing them
> Proof is that "done!" is echoed.
> Step by step debugging also prove that , the only thing is that
> file_put_contents, doesn't execute, but returns a value...
>
>
>
> 2007/11/20, chetan rane <[EMAIL PROTECTED]>:
>
> > This aint a bug
> >
> > because __sleep is called only when you serialize an object and not when
> > you assign it to a session Variable;
> >
> > On Nov 21, 2007 12:21 AM, Julien Pauli < [EMAIL PROTECTED]> wrote:
> >
> > > Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
> > > machine :
> > > <?php
> > > class a
> > > {
> > >    public $b;
> > >
> > >    public function __sleep()
> > >    {
> > >        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
> > >        echo "done!";
> > >        return array();
> > >    }
> > > }
> > >
> > > $a = new a;
> > > serialize($a);
> > > ?>
> > >
> > > No problem here, log.txt is writtable, when it passes on the
> > > serialize()
> > > instruction, it goes to __sleep and works well.
> > > "OK\r\n" is appended to the log file , and "done!" is displayed.
> > >
> > >
> > >
> > > Now consider this :
> > >
> > > <?php
> > > session_start();
> > > class a
> > > {
> > >    public $b;
> > >
> > >    public function __sleep()
> > >    {
> > >        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
> > >        echo "done!";
> > >        return array();
> > >    }
> > > }
> > >
> > > $a = new a;
> > > $_SESSION['obj'] = $a;
> > > ?>
> > >
> > > In this case, when the object is going in the session, it naturally
> > > passes
> > > throught __sleep().
> > > The problem is that file_put_contents() doesn't work -> the file is
> > > not
> > > appended "OK\r\n" as it should be.
> > > "done!" is displayed , and if you look at the return value of
> > > file_put_contents ( number of bytes that have been written ) : it's
> > > all
> > > right ! It simply doesn not write to the file.
> > >
> > > Anyone has an idea ?
> > > Is this a bug ?
> > > Thx :)
> > >
> >
> >
> >
> > --
> > Have A plesant Day
> > Chetan. D. Rane
> > Location: India
> > Contact: +91-9844922489
> > otherID: [EMAIL PROTECTED]
> >             [EMAIL PROTECTED]
> >
>
>


-- 
Have A plesant Day
Chetan. D. Rane
Location: India
Contact: +91-9844922489
otherID: [EMAIL PROTECTED]
            [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
2007. 11. 21, szerda keltezéssel 14.12-kor chetan rane ezt írta:
> Sorry Buddie But Session dose not serialize the Object Please Have a look at
> the Code Again I have tried it with PHP 5.2
> IT dose not call __sleep function. only when you have serialize it calls it.

AFAIK session does serialize the objects. and calls the __sleep method
as well.
http://hu.php.net/manual/en/language.oop.serialization.php

greets
Zoltán Németh

> 
> 
> On Nov 21, 2007 3:23 AM, Julien Pauli <[EMAIL PROTECTED]> wrote:
> 
> > Sorry but it goes throught __sleep() as session serializes objects before
> > storing them
> > Proof is that "done!" is echoed.
> > Step by step debugging also prove that , the only thing is that
> > file_put_contents, doesn't execute, but returns a value...
> >
> >
> >
> > 2007/11/20, chetan rane <[EMAIL PROTECTED]>:
> >
> > > This aint a bug
> > >
> > > because __sleep is called only when you serialize an object and not when
> > > you assign it to a session Variable;
> > >
> > > On Nov 21, 2007 12:21 AM, Julien Pauli < [EMAIL PROTECTED]> wrote:
> > >
> > > > Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
> > > > machine :
> > > > <?php
> > > > class a
> > > > {
> > > >    public $b;
> > > >
> > > >    public function __sleep()
> > > >    {
> > > >        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
> > > >        echo "done!";
> > > >        return array();
> > > >    }
> > > > }
> > > >
> > > > $a = new a;
> > > > serialize($a);
> > > > ?>
> > > >
> > > > No problem here, log.txt is writtable, when it passes on the
> > > > serialize()
> > > > instruction, it goes to __sleep and works well.
> > > > "OK\r\n" is appended to the log file , and "done!" is displayed.
> > > >
> > > >
> > > >
> > > > Now consider this :
> > > >
> > > > <?php
> > > > session_start();
> > > > class a
> > > > {
> > > >    public $b;
> > > >
> > > >    public function __sleep()
> > > >    {
> > > >        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
> > > >        echo "done!";
> > > >        return array();
> > > >    }
> > > > }
> > > >
> > > > $a = new a;
> > > > $_SESSION['obj'] = $a;
> > > > ?>
> > > >
> > > > In this case, when the object is going in the session, it naturally
> > > > passes
> > > > throught __sleep().
> > > > The problem is that file_put_contents() doesn't work -> the file is
> > > > not
> > > > appended "OK\r\n" as it should be.
> > > > "done!" is displayed , and if you look at the return value of
> > > > file_put_contents ( number of bytes that have been written ) : it's
> > > > all
> > > > right ! It simply doesn not write to the file.
> > > >
> > > > Anyone has an idea ?
> > > > Is this a bug ?
> > > > Thx :)
> > > >
> > >
> > >
> > >
> > > --
> > > Have A plesant Day
> > > Chetan. D. Rane
> > > Location: India
> > > Contact: +91-9844922489
> > > otherID: [EMAIL PROTECTED]
> > >             [EMAIL PROTECTED]
> > >
> >
> >
> 
> 

--- End Message ---
--- Begin Message ---
chetan rane wrote:
> Sorry Buddie But Session dose not serialize the Object Please Have a look at
> the Code Again I have tried it with PHP 5.2
> IT dose not call __sleep function. only when you have serialize it calls it.

this is completely untrue. during the shutdown phase objects
in the $_SESSION superglobal are serialized and __sleep() is called if defined.

> 
> 
> On Nov 21, 2007 3:23 AM, Julien Pauli <[EMAIL PROTECTED]> wrote:
> 
>> Sorry but it goes throught __sleep() as session serializes objects before
>> storing them
>> Proof is that "done!" is echoed.
>> Step by step debugging also prove that , the only thing is that
>> file_put_contents, doesn't execute, but returns a value...
>>
>>
>>
>> 2007/11/20, chetan rane <[EMAIL PROTECTED]>:
>>
>>> This aint a bug
>>>
>>> because __sleep is called only when you serialize an object and not when
>>> you assign it to a session Variable;
>>>
>>> On Nov 21, 2007 12:21 AM, Julien Pauli < [EMAIL PROTECTED]> wrote:
>>>
>>>> Consider that very simple code, that runs on PHP 5.2.5 onto a Windows
>>>> machine :
>>>> <?php
>>>> class a
>>>> {
>>>>    public $b;
>>>>
>>>>    public function __sleep()
>>>>    {
>>>>        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
>>>>        echo "done!";
>>>>        return array();
>>>>    }
>>>> }
>>>>
>>>> $a = new a;
>>>> serialize($a);
>>>> ?>
>>>>
>>>> No problem here, log.txt is writtable, when it passes on the
>>>> serialize()
>>>> instruction, it goes to __sleep and works well.
>>>> "OK\r\n" is appended to the log file , and "done!" is displayed.
>>>>
>>>>
>>>>
>>>> Now consider this :
>>>>
>>>> <?php
>>>> session_start();
>>>> class a
>>>> {
>>>>    public $b;
>>>>
>>>>    public function __sleep()
>>>>    {
>>>>        file_put_contents("log.txt","ok" . PHP_EOL,FILE_APPEND);
>>>>        echo "done!";
>>>>        return array();
>>>>    }
>>>> }
>>>>
>>>> $a = new a;
>>>> $_SESSION['obj'] = $a;
>>>> ?>
>>>>
>>>> In this case, when the object is going in the session, it naturally
>>>> passes
>>>> throught __sleep().
>>>> The problem is that file_put_contents() doesn't work -> the file is
>>>> not
>>>> appended "OK\r\n" as it should be.
>>>> "done!" is displayed , and if you look at the return value of
>>>> file_put_contents ( number of bytes that have been written ) : it's
>>>> all
>>>> right ! It simply doesn not write to the file.
>>>>
>>>> Anyone has an idea ?
>>>> Is this a bug ?
>>>> Thx :)
>>>>
>>>
>>>
>>> --
>>> Have A plesant Day
>>> Chetan. D. Rane
>>> Location: India
>>> Contact: +91-9844922489
>>> otherID: [EMAIL PROTECTED]
>>>             [EMAIL PROTECTED]
>>>
>>
> 
> 

--- End Message ---
--- Begin Message ---
Casey,

There is no SVG support in PHP, as far as I know.

Thank you. That clears things up. I'll just go with PNGs then.

--
Dave M G

--- End Message ---
--- Begin Message ---
Maybe too late. Here are some simple starting points.

If you want to send pictures as MMS messages, you will need to use an SMS gateway. How different the protocols are for SMS and MMS, I don't know. But I've used www.clickatel.com's SMS gateway happily. So, you might want to start there. They are responsive - so you could probably get advice. They even have some PHP scripts for interacting with their gateway.

If you want to make pictures available as images on web enabled telephones, I suggest you download Opera web browser. It has a function that allows you to preview small screen pages, which can be useful for developing if you want to use this route.

Good luck!

Jeffrey

[EMAIL PROTECTED] wrote:
Hey list,

I'm doing some R&D for a project at my job and my boss wants the ability
to send pictures to cell phones. I was wondering if anyone had any
experience with this or could point me in the right direction to get
started.

Thanks,
Jeremy


--- End Message ---
--- Begin Message ---
Hi, a basic question:
I want to send a CSV file and some other parameters. In my FORM I have
method=POST input type="file" and action="http://....php";; It sends it to
the php file but I don't want the php to be visualized (in fact it just
works with the data  and inserts in database). I want to keep the original
HTML and the php working "in the background". 

Is for that absolutely necessary Ajax? 

thanks,
Pere
-- 
View this message in context: 
http://www.nabble.com/uploading-files...-necessary-Ajax--tf4849678.html#a13875829
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message --- "pere roca" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]

Hi, a basic question:
I want to send a CSV file and some other parameters. In my FORM I have
method=POST input type="file" and action="http://....php";; It sends it to
the php file but I don't want the php to be visualized (in fact it just
works with the data  and inserts in database). I want to keep the original
HTML and the php working "in the background".

Is for that absolutely necessary Ajax?

thanks,
Pere
--
View this message in context: http://www.nabble.com/uploading-files...-necessary-Ajax--tf4849678.html#a13875829
Sent from the PHP - General mailing list archive at Nabble.com.

Hi

Why don'tr you upload the file and have a cronjob running in the background, executing the PHP file on command line? That way, the work will get done and the user won't see anything.

Just an idea :o)

Chris
--- End Message ---
--- Begin Message ---
Hey folks,

Does anyone have any resources or links to resources concerning obtaining book data via Amazons web services?

Any help/pointers appreciated.

Scott.

--- End Message ---

Reply via email to