Blog - images & weirdness.
Am I missing something?
I'm looking to rip the blog upload images functionality into something else and noticed some things:
1) Uploading .jpg to a post (post_1) works fine. Images are sent. Editing the post the images are still there.
2) They're not displayed anywhere though (?). Didn't see anything in the model about images.
3) Uploading an image that is too big to post_2, you get the error notification, then upload a legit image and you still get the error - had to refresh the page (FF3.6.13/OSX1.5.8) for it to work again.
4) Now I have two blog posts with images, editing either one shows none of the images.
Images are dumped into the directory you set in the settings but at the root of that I.E. there is no id folder or whatever to group per post. Problem? I can't see anything in the schema to store post images.
Is their some magic happening elsewhere to pull the related images for a post on edit?
Blog_posts_model()->form_fields():
$fields['upload_images'] = array('type' => 'file', 'class' => 'multifile', 'order' => 6, 'upload_path' => assets_server_path($CI->fuel_blog->settings('asset_upload_path')), 'comment' => 'Upload images to be used with your blog posts');
That's not getting any values set there.
Comments
To increase the size limit (both weight, height and width) you can adjust that in your fuel/application/config/MY_fuel.php file
$config['assets_upload_max_size']
$config['assets_upload_max_width']
$config['assets_upload_max_height']
http://www.getfuelcms.com/user_guide/general/configuration
Hope that helps
So when I edited the post after the upload the images were probably just cached in the interface?
Can you point me in the right direction to where in the code (or maybe when is a better term) the images are saved/shifted to the hidden "upload_images_path" form value?
I'd like to use on_after_save(), get the new id, create folder and stick 'em in there...
Thanks for the speedy reply, you ever take a break?!
Answering forum posts is usually a break for me :-)
$fields['upload_images'] = array('type' => 'file', 'class' => 'multifile', 'order' => 6, 'upload_path' => assets_server_path($CI->fuel_blog->settings('asset_upload_path').'{id}/'), 'comment' => 'Upload images to be used with your blog posts');
I'm looking to use this outside the blog, is it a function of the blog module or core? or something else?
Any pointers as to where/when in the form post the images are getting saved?
In the case of a new entry there won't be an id to insert so it's dumping at the root instead. Would need to use on_after_save() to get the id. Is $_Files[] still going to be accessible at that point?
on_after_save should have that id value. You could also manually set a $_POST value in one of the other hooks and use that as the merge value in the upload path, or perhaps use the 'permalink' (e.g. 'upload_path' => 'blog/{post_folder}')?... Haven't tried it yet on my end.