Config Event Observer Definition (Frontend, Admin & Global)
Frontend:
<config>
<frontend>
<events>
<the_name_of_the_event_to_observe>
<observers>
<namespace_module>
<class>namespace_module/observer</class>
<method>someMethod</method>
</namespace_module>
</observers>
</the_name_of_the_event_to_observe>
</events>
</frontend>
</config>
Admin:
...
Config Block Definition
<config>
<global>
<blocks>
<namespace_module>
<class>Namespace_Module_Block</class>
</namespace_module>
</blocks>
</global>
</config>
Config Setup Definition (EAV & Flat)
EAV:
<config>
<global>
<resources>
<namespace_module_setup>
<setup>
<module>Namespace_Module</module>
<class>Mage_Eav_Model_Entity_Setup</class>
</setup>
</namespace_module_setup>
</resources>
</global>
</config>
Flat:
<config>
<global>
<resources>
<namespace_module_setup>
<setup>
<module>Na...
Config Model & Resource Model Definition
<config>
<global>
<models>
<namespace_module>
<class>Namespace_Module_Model</class>
<resourceModel>namespace_module_resource</resourceModel>
</namespace_module>
<namespace_module_resource>
<class>Namespace_Module_Model_Resource</class>
<entities>
<some_entity>
<table>namespace_module_some_entity</table>
</some_entity>...
Table Creation In Magento 1.6/1.11+
Magento CE 1.6 and PE/EE 1.11 introduced database abstraction, this is the way to set up tables using the new code.
$table = $installer->getConnection()
->newTable($installer->getTable('your_module/table_name_in_xml'))
->addColumn(
'entity_id',
Varien_Db_Ddl_Table::TYPE_INTEGER,
null,
array(
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true,
),
'Entity ...
Resizing via Varien_Image
$image = new Varien_Image('/full/fs/path/to/image.jpg');
// you cannot use method chaining with Varien_Image
$image->constrainOnly(false);
$image->keepFrame(true);
// avoid black borders by setting background colour
$image->backgroundColor(array(255,255,255));
$image->keepAspectRatio(true);
$image->resize(216, 139);
$image->save('/full/fs/path/to/save/to.jpg');