Created
April 10, 2013 16:58
-
-
Save bjornbjorn/5356442 to your computer and use it in GitHub Desktop.
Replacing {filedir_1} in channel_data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$grid_image = str_replace('{filedir_1}', '/uploads/', $grid_image); | |
/** | |
This is how the above _should_ be done: | |
if (preg_match('/^{filedir_(\d+)}/', $src, $matches)) | |
{ | |
$filedir_id = $matches[1]; | |
$this->EE->load->model('file_upload_preferences_model'); | |
$upload_dest_info = $this->EE->file_upload_preferences_model->get_file_upload_preferences(FALSE, $filedir_id); | |
$src = str_replace('{filedir_'.$filedir_id.'}', $upload_dest_info['server_path'], $src); | |
} | |
* | |
* .., but premature optimalization ftw! | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment