We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 41101
    • 40 Posts
    Hi,

    Does anyone know if it's possible to add a separate Image upload field to NewsPublisher, instead of using the RTE to upload a new image.

    I'm trying to get it so a few of us can add blogs from our phones, but the TinyMCE doesn't work so well on phones.

    I basically need 3 fields - Title, Image, Content - I have Title and Content working fine, I could also upload images from TinyMCE but it's difficult on the phone. I need to add a third field which would be a simple file input, I can then select an image from my phone and upload it and add it to the content.

    Is there a way of doing this in NewsPublisher or do I need to go further?

    Thanks,

    John
      • 3749
      • 24,544 Posts
      You could try creating individual TV's for each field (using a File or Image TV for the file and text TVs for the other fields). Then you could have a NewsPublisher page with just those fields in the &show property.

      I'm not sure the NewsPublisher File/Image browser would work on a phone either but it's worth a try.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 41101
        • 40 Posts
        Hi Bob,

        Thanks for your reply.

        I set up a TV to handle the Image upload but as you suspected it's still not very mobile friendly. Is there something I can do with media sources so that instead of opening up the modX filebrowser it automatically opens up the storage on the users device? Do you think I'd be better using something like Formit in conjunction with NewsPublisher?

        Kind Regards.
          • 3749
          • 24,544 Posts
          The FileUpload snippet should go directly to the users device, though I think you'd have to make some modifications to get the extra fields.

          You might try one of the MODX Gallery extras, they should do the same thing and give you the extra fields and even some image processing if you like.

          If you were going to go to FormIt, I'd skip using NewsPublisher and just use a FormIt postHook to embed the photo in a resource.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 41101
            • 40 Posts
            Hi Bob,

            Sorry - I thought I had replied to your post.

            I'm still struggling to get this working.

            How would I go about using Formit to embed a photo into a Article? Is this really complicated? I only have moderate experience with PHP and developing for ModX.

            I did try something else, which was to edit the npfiletpl chunk so that it shows a simple file upload. The issue would then be processing the image upload and embedding it within the content. I did look around lines 1411 of newspublisher.class.php
            $fields['content']  = $this->header . isset ($_POST['ImageUpload']) ? $_POST['ImageUpload']:  $fields['content'] . $this->footer;


            I'd need to use the URL/filename of the uploaded Image there I'm thinking.

            Am I anywhere close or, beond struggling smiley

            Thanks.
              • 3749
              • 24,544 Posts
              I wouldn't recommend altering the NewsPublisher PHP code.

              Have you tried the FileUpload snippet to see how that works on a phone?

              You might also try having the users upload the images to a public service like Flickr, Picassa, Instagram, or something similar (your account or theirs). Then you could have a plain text TV with the URL of the photo.

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 41101
                • 40 Posts
                Quote from: BobRay at Oct 11, 2013, 06:11 AM
                I wouldn't recommend altering the NewsPublisher PHP code.

                Have you tried the FileUpload snippet to see how that works on a phone?

                You might also try having the users upload the images to a public service like Flickr, Picassa, Instagram, or something similar (your account or theirs). Then you could have a plain text TV with the URL of the photo.


                Hi Bob

                Thanks for your reply.

                How do I use the FileUpload snippet? I wasn't sure about that..

                  • 3749
                  • 24,544 Posts
                  You just put a tag for it on a page with (optionally) properties in the tag to control it: http://bobsguides.com/fileupload-tutorial.html
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 41101
                    • 40 Posts
                    Hi Bob,

                    Thanks for the reply.

                    Is it possible to use FileUpload in conjunction with Newspublisher and embed an image within a post?

                    The other guys who use the site want it all to be done within that site rather than using a 3rd party site like flikr or photobucket e.t.c. To recap I need to use the Newpublisher add on to create a new Article Post (this works a treat) but need to embed an image into the Article Post using FileUpload.

                    If anyone can help with this, there is a budget available.

                    Cheers.
                      • 3749
                      • 24,544 Posts
                      Quote from: jonboy at Oct 28, 2013, 10:33 AM

                      Is it possible to use FileUpload in conjunction with Newspublisher and embed an image within a post?

                      I've never tried it. It should be possible to put a tag for FileUpload in the content of the NewsPublisher Resource, but the image wouldn't be associated with the saved page unless you write a plugin to connect it somehow (e.g., write the image path to one of the page's TVs). I think OnDocFormSave will be fired so a plugin attached to that might work.

                      BTW, you might try Discuss. It might have image-upload capability and could be phone friendly.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting