Knowledgebase



 Categories





 Dimofinf Mobile


Subscribe now to Dimofinf Mobile and enjoy a wide range of premium services. You will receive our SMS text messages wherever you are for a very low cost! More


 Currency Converter


  • Currency
  • US$ Amount

Files functions



  • file_extension($filename)

This function is used to return the file extension.

Parameters:

      -  
$filename (mandatory):the file name including the extension.

Example:

PHP :
{* php buffer start *} $ext file_extension(strtolower($filename)); 
{* php buffer end *}

  • checkmymType($filename, $extarray)

This function is used to verify the 'mimeType' of the file.

Parameters:

      -  
$filename (mandatory): the file extension.
      -  $extarray (mandatory): the allowed mimeType matrix.

Example:

PHP :
{* php buffer start *} checkmymType(strtolower($ext), array("image") 
{* php buffer end *}

Note: We should add our Mimetype matrix URL

  • handle_upload(&$files, &$mtypes, $maxmsize = 10485760)

This function is used for processing files before the uploading process in order to make sure they are valid for uploading. It returns a matrix for files chosen for upload then file transfer can be started using the function 'move_uploaded_file'.

Parameters:

      -  
$files (mandatory): the files matrix of the files to be processed and uploaded.
      -  $mtypes (mandatory): the allowed mimeType matrix.
      -  $maxmsize (optional): the maximum size for uploaded files.

Example:

PHP :
{* php buffer start *} $uploadsum count($dimofinf->GPC['media']['tmp_name']);
$mediatypes = array("image");
if(
$uploadsum)
{
<em>/* handle uploads */
</em>include_once(DIR ."/include/class_upload.php");
$retfiles = handle_upload($dimofinf->GPC['media'],
$mediatypes$dimofinf->options["album_attachmentmxs"]);

{* php buffer end *}

  • convertBmp($paths,$columns,$table,$where)

This function is used to convert Bmp pictures to Jpeg pictures so that they can be processed in other ways like decreasing or as a Watermark. This function returns the new extension after transferring the picture, noting that calling the transfer line can be done directly after uploading the picture and before the processing of decreasing the picture, watermark or writing text on the picture.

Parameters:

      -  
$paths (mandatory): the path of the Bmp picture to be converted.
      -  $columns (mandatory): the column name where the extension will be stored in the content table within the database.
      -  $table (mandatory): the name of the content table where the picture will be stored in the database.
      -  $where (mandatory): the condition 'where' for the stored picture indication in the database. It may
             include the content/picture ID in the database.  

Example:

PHP :
{* php buffer start *} @move_uploaded_file($value[&#039;tmp_name'], 
DIR ."/contents/albumsm/".$attachments[$key]['name']);
$ext = convertBmp(DIR ."/contents/albumsm/".$attachments[$key]
['name'],"ext","albumsm","id=".
$dimofinf->GPC['id']); 
{* php buffer end *}

  • Dim_Img_Resize($image_source, $thumb_x, $thumb_y, $output_file, $ext)

This function is used to create picture thumbs.

Parameters:

      -  
$image_source (mandatory): the main picture path.
      -  $thumb_x (mandatory): the width value for the picture thumb.
      -  $thumb_y (mandatory): the height value for the picture thumb.
      -  $output_file (mandatory): the full path for storing the picture thumb including the name.
      -  $ext (mandatory): the thumb storage extension.

 Example:

PHP :
{* php buffer start *} $filename $filename[&#039;name'];
$m1size = @getimagesize(DIR ."/contents/albumsm/".$filename);
if(
$m1size[0] >$dimofinf->options['albumlths'])
{
@Dim_Img_Resize(DIR ."/contents/albumsm/".
$filename
$dimofinf->options['albumlths'], 0, DIR ."/contents/albumsm/".$filename$ext);

{* php buffer end *}

  • watermark($file, $force = false)

This function is used to add watermark text on the picture depending on the 'text on picture' settings in the Dimofinf settings.

Parameters:

      -  
$file (mandatory): the main file to write on.
      -  $force (mandatory): the value 'boolean true/false' is used to set the writing to mandatory.

Example:

PHP :
{* php buffer start *} if($dimofinf->options[&#039;enablewmark'])
{
$imagegd DIR ."/contents/albumsm/".$filename;
include_once(DIR ."/include/class_watermark.php");
$wmark = new DIM_watermark();
$wmark->watermark($imagegd, 1, 0);

{* php buffer end *}

  • get_items_from_data_store_by_tbl_name($tbl_name = THIS_SCRIPT, $mother_id = 0, $limit = false, $perpage = false)

This function is used to return a matrix of a module sections and determining whether they are main sections or sub sections of the main section.

Parameters:

      -  
$tbl_name (mandatory): the name of the module in the database that contains the sections.
      -  $mother_id (mandatory): the parent section ID which includes the sections, a number can be
             added to get all parent sections.
      -  $limit (optional): the total number value of the desired sections.
      -  $perpage (optional): the number of sections to display per page.

Example:

PHP :
{* php buffer start *} $count[&#039;total'] = count(get_items_from_data_store_by_tbl_name("articles", 0));
$perpage $dimofinf->options[&#039;articlenc'] !=""? $dimofinf->options['articlenc'] : 3;
if($dimofinf->GPC[&#039;catpage'] <1)
{
$dimofinf->GPC[&#039;catpage'] = 1;
}
else
{
if(
$dimofinf->GPC[&#039;catpage'] >ceil(($count['total'] + 1) / $perpage))
{
$dimofinf->GPC[&#039;catpage'] = ceil(($count['total'] + 1) / $perpage);
}
}
/* initialise some stuff... */
$limit = ($dimofinf->GPC[&#039;catpage'] - 1) * $perpage;
$cats get_items_from_data_store_by_tbl_name("articles", 0, $limit$perpage); 
{* php buffer end *}


Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

General functions (Views: 498)

Dimofinf appreciates your time and so, we offer you a selection of ready functions and constants...


Editor functions (Views: 432)

Dim_editor($area, $text ="", $rows = 26, $showresize = false, $dimcp = false, $editor_id = 0,...


Content functions (Views: 441)

recursive($dynamic_cat_id,$module,$rate)This function is important and should be added at the end...


User functions (Views: 481)

verify_id($idname, &$id, $alert = true, $selall = false, $options = 0)This function is used...


Email functions (Views: 448)

[php]DIM_mail($remail, $rname, $message, $subject, $semail ="", $sname ="", $priority = 3, $mass...



Online