If you are getting Malformed image URL in Node export. Then you have to change the code in Node Export module
Try to use image_create_url() instead of url() in node_export.module file: Line 1052
- $export_data = url($file->uri, array('absolute' => TRUE));
+ $export_data = file_create_url($file->uri, array('absolute' => TRUE));
Web Development Information [PHP, DRUPAL, MYSQL, MAGENTO, JQUERY, JAVASCRIPT, CSS, HTML5]
Thursday, September 18, 2014
Monday, March 17, 2014
Get the file size in Drupal
The following function is used to return the file size,
$file = file_load($fid)
echo filesize(drupal_realpath($file->uri));
url - it will return the file public url (public://filname.ext)
file_create_url() - it will return there relative url of the file (http://localhost/sites/default/files/filname.ext)
drupal_realpath() - it will return the absolute url of the file path.(sites/default/files/filename.ext)
$file = file_load($fid)
echo filesize(drupal_realpath($file->uri));
url - it will return the file public url (public://filname.ext)
file_create_url() - it will return there relative url of the file (http://localhost/sites/default/files/filname.ext)
drupal_realpath() - it will return the absolute url of the file path.(sites/default/files/filename.ext)
Thursday, March 13, 2014
Find the text or value in MYSQL table using REGEXP
We can use REGEXP command to find the string value in MYSQL table.
SELECT * FROM <table> WHERE <column> REGEXP '<string>';
Ex: SELECT * FROM watchdog WHERE message REGEXP 'message'
SELECT * FROM <table> WHERE <column> REGEXP '<string>';
Ex: SELECT * FROM watchdog WHERE message REGEXP 'message'
Monday, February 24, 2014
Delete operation in Drupal 7
The following function is used to delete file and file usage in Drupal 7.
file_data($file);
The following db function is used to delete a record from a table in Drupal 7.
db_delete('table')->condition('field', $value->execute();
The following drupal function is used to delete a node in Drupal 7.
node_delete($nid);
Multiple node delete: node_multiple_delete(array($nid1, $nid2));
The following drupal function is used to delete a user in Drupal 7.
user_delete($uid);
Multiple user delete: user_multiple_delete(array($uid1, $uid2));
The following drupal function is used to delete a content type in Drupal 7.
node_type_delete($type);
file_data($file);
The following db function is used to delete a record from a table in Drupal 7.
db_delete('table')->condition('field', $value->execute();
The following drupal function is used to delete a node in Drupal 7.
node_delete($nid);
Multiple node delete: node_multiple_delete(array($nid1, $nid2));
The following drupal function is used to delete a user in Drupal 7.
user_delete($uid);
Multiple user delete: user_multiple_delete(array($uid1, $uid2));
The following drupal function is used to delete a content type in Drupal 7.
node_type_delete($type);
Friday, February 21, 2014
Use file_prepare_directory() instead of file_check_directory()
In Drupal 7, use file_prepare_directory() instead of file_check_directory() from Drupal 6.
Subscribe to:
Posts (Atom)