Author Topic: Optimisation  (Read 12617 times)

0 Members and 1 Guest are viewing this topic.

Offline Yatahonga

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • http://www.yatahonga.com/
Optimisation
« on: March 25, 2003, 11:07:00 AM »
Hi,

We have some optimisation problem : http://www.yatahonga.com/

We have :
2946 images in 28 categories for everyBody
AND :
5625 images in 39 categories for MEMBERS.

The HomePage give me :
Page generated in 10.674173 seconds with 12 queries, spending 6.196000 seconds doing MySQL queries and 4.478173 doing PHP things. GZIP compression disabled

How can have a Page generated in 3 seconds ?

Do I disable "Random image" section ?

thank's

Cyrille

Offline cisiodon

  • Full Member
  • ***
  • Posts: 157
    • View Profile
Optmization
« Reply #1 on: March 25, 2003, 11:43:15 AM »
I particulary using:

AdoDB writing Cache, and made index in others fields into MysQL. I have about 4000 images, and page generetade 3 or 4 seconds .

For those that want use AdoDB:

include("./pnadodb/adodb.inc.php");
 $ADODB_CACHE_DIR = 'drive:\\temp'; // for Win32
 $db = NewADOConnection('mysql');
 $db->Connect("yourhost", "usert", "pass", "Data_base_name");
 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_modules');
 else $rs = $db->CacheExecute('select * from nuke_modules');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_postwrap_url');
 else $rs = $db->CacheExecute('select * from nuke_postwrap_url');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_blocks');
else $rs = $db->CacheExecute('select * from nuke_blocks');


 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_forums');
else $rs = $db->CacheExecute('select * from nuke_xforum_forums');

 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_posts');
else $rs = $db->CacheExecute('select * from nuke_xforum_posts');

 if (isset($cache)) $rs = $db->CacheExecute(120,'select * from nuke_xforum_threads');
else $rs = $db->CacheExecute('select * from nuke_xforum_threads');

while (!$rs->EOF) {
$rs->MoveNext();
}


This is an example working in Postnuke, and if you want use it in 4images, just change fields and insert into index.php..


Mike
http://www.netforum.com.br

Running PostNuke Multi Theme -  X-Forum - WebCam Portal - 4Images gallery
Banner Exchange 1:1
Paint Board on Line with Gallery and Blogs
Powered by AdoDB

I am not the owner of the world... But I am the son of it!

Offline Yatahonga

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • http://www.yatahonga.com/
Optimisation
« Reply #2 on: March 26, 2003, 09:21:15 AM »
Thansk,

But what is "spending 6.196000 seconds" ???

Cyrille

Offline Yatahonga

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • http://www.yatahonga.com/
Optimisation
« Reply #3 on: March 27, 2003, 08:39:03 AM »
Thank's ;-)

It's a Delphi Application it works with a HTML form.
The POST data with this application into a Submit page.

It's not so hard.
All component exist :
http://www.indyproject.org/dowload/index.html
or ICS : http://overbyte.delphicenter.com/frame_index.html

Ask me, if you want more informations.

Cyrille

Offline Yatahonga

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • http://www.yatahonga.com/
Optimisation
« Reply #4 on: March 27, 2003, 11:59:47 AM »
What is a "bloody noob " ?

Of course I can write something about the uploader with source code
in Delphi and PHP.

I will try to make an extract the Week-end

Cyrille

Offline Yatahonga

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • http://www.yatahonga.com/
Uploader : Delphi.
« Reply #5 on: April 28, 2003, 11:38:27 AM »
This is the SendImage function

procedure TFYatahonga.SendImage(user_id : string; direct_upload : string; cat_id : string;
                                media_file : string; thumb_file : string; image_name : string;
                                host : string; url : string);
var
  Source: TIdMultiPartFormDataStream;
begin
  Source := TIdMultiPartFormDataStream.Create;
  try
    Source.AddFormField('action', 'uploadimage');

    Source.AddFormField('user_id', user_id);
    Source.AddFormField('direct_upload', direct_upload);
    Source.AddFormField('cat_id', cat_id);
    Source.AddFormField('image_name', image_name);
    if media_file<>'' then
      begin
        Source.AddFile('media_file', media_file, 'image/jpeg');
        Source.AddFormField('dummy1', 'eof');
      end;
    if thumb_file<>'' then
      begin
        Source.AddFile('thumb_file', thumb_file, 'image/jpeg');
        Source.AddFormField('dummy2', 'eof');
      end;

    IdHTTPConnect.Post(host + url, Source);
  finally
    Source.Free;
  end;
end;

You can call them like this :
  SendImage(CfgUserId, cstdirect_upload, categorie, Nfile, NThumbFile, texte, cstHost, YatUrlUpload);

where CfgUserId, cstdirect_upload, categorie, Nfile, NThumbFile, texte, cstHost, YatUrlUpload are param in a WEB Form at the adress :
http://cstHost/YatUrlUpload

Soon

Cyrille

Offline tdkpaul

  • Full Member
  • ***
  • Posts: 205
    • View Profile
Re: Optimisation
« Reply #6 on: August 02, 2006, 12:56:18 AM »
wow this is very nice

i try it for my personal gallery