Blog - images & weirdness.

edited December 2010 in Bug Reports
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

  • edited December 2010
    The image upload for the blog post is really just a convenience to upload images without going to the assets area. You have to specify where those images will appear in the content of your post either using the image insert button in the content area or something like <img src="{img_path('blog/my_image.jpg')}" />. The images are not stored in a per post subfolder.

    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
  • edited 4:21AM
    Oh okay.. that's cool - thought I was losing my mind for a second!

    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?!
  • edited December 2010
    It's possible that the images were cached but am not sure. What happens if you change the settings for the image upload path to blog/{id}/ ?

    Answering forum posts is usually a break for me :-)
  • edited 4:21AM
    Yeah that works, created a folder and stuck it in there:

    $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?
  • edited 4:21AM
    It's not specific to the blog. You can specify the 'upload_path' for any file upload form field and use the placeholders in the path (e.g. {id}) to substitute in values from the current record you are editing.
  • edited 4:21AM
    Sweet thanks.

    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?
  • edited 4:21AM
    The _process_uploads method in the fuel/modules/fuel/controllers/module.php file contains the logic for uploading the images. It gets called in the create and edit methods in the same file.

    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.
Sign In or Register to comment.