Fork me on GitHub

Pagesetter Image Upload Fields  Bottom

  • In a Pagesetter publication type, it's not atypical for me to have up to 20 or so image upload fields. If the images aren't resized before the publication submission, in most cases, the submission fails.

    Is there a way to do some sort of asynchronous upload for images? Perhaps some PFM?
    If anyone willing to diddle something up to fix this, let me know $
  • You could use zikulapro.com and ask for bids. icon_evil
  • It' possible. Look at how Pagesetter stores your image data in the column in mysql, you'll need to create a bulk query to update your publication records to insert that info. Then look at how Pagesetter renames your files in the upload folder, and rename your images to match; the file names consist of the publication type and pid, ending in .dat. The images aren't converted themselves, just renamed.

    You may have better luck though submitting your images one at a time so you don't get timeout issues.
  • bronto

    It' possible. Look at how Pagesetter stores your image data in the column in mysql, you'll need to create a bulk query to update your publication records to insert that info. Then look at how Pagesetter renames your files in the upload folder, and rename your images to match; the file names consist of the publication type and pid, ending in .dat. The images aren't converted themselves, just renamed.

    You may have better luck though submitting your images one at a time so you don't get timeout issues.


    If I was the end user, I would just resize the images and Bob's your uncle.
    I would like to have a non-technical end user to have the ability to just upload their images all at once.
    I'm sure there's some sort of javascript ditty that could be bashed into submission for this purpose.
    Unfortunately, this is beyond my 1337 skillz, so if anyone is willing to jump in, let me know what you think it's worth.
  • Can you describe what you mean by "asynchronous upload" ?
  • swfupload needs to hooked into PS for some serious winnage.
  • If timeout is the problem you could simply add a 'set_time_limit(0)', probably in pagesetter_user_pubedit().
  • Quote

    swfupload needs to hooked into PS for some serious winnage.

    +1!

    I just took a look at SWFUpload... whoa!
    http://demo.swfupload.org/v220/applicationdemo/index.php

    Often I have publications that require images but I am never sure of how many images I need... sure, in the past I've created 30 image fields and just run Smarty template checks to display only fields with images but really- having 30 fields when you only need 3 images stinks... and visa versa when you need 40 images but only have 30 fields... well, up the river...

    I haven't played with SWFUpload but methinks it "should" be possible to use the SWFUpload code in a pgForms template and to create a custom Pagesetter workflow action to use PHP to take the uploaded files (they go somewhere right?), rename then a la Pagesetter (pid.tid.revision.dat) (thumbnails might be a bit trickier....?) and then update a Pagesetter field (say, "images") with all the image names in a comma or semicolon separated string... then in the template we can use some Smarty to loop through that field with all the file names and display them... that way we can add as many images as we so choose without having to use Pagesetter's built-in system...

    Sound good...? Any thoughts?
    I might try and play with this after the Holiday weekend (I have to sit on the beach and drink some beers!)

    -J

    --
    Burnham Racing
    Illinois Cycling Association
  • Quote

    I might try and play with this after the Holiday weekend (I have to sit on the beach and drink some beers!


    I'll buy you a beer! OMG!
  • remmingtonshowdown

    Sound good...? Any thoughts?


    Yes: first of all Pagesetter relations. If the amount of images linked to a publication is dynamic you should rather create a separate publication type that holds an image and use a 1-n relationship. Though you can only create the relations once the main publication has been created. Now I'd rather recommend something stronger while you think about that icon_evil

    Cheers
  • Well, the idea is to be able to upload as many images as one likes and have them associated with a particular publication instance... It seems that making another publication and using relations is a bit backwards, no?

    Isn't there an upload module that hooks into other modules... does that work with Pagesetter...?

    Really, we should just come up with a guppy plugin, or better yet a pgForms plugin :) that will allow us to upload a dynamic number of images and have them stored as a string in a Pagesetter field...

    It's not that I dislike Pagesetter's upload system- I just find it amazingly limiting... partisularly for such a flexible product.

    Or- if we're shooting for the stars- why not a plugin that allows the uploading of a dynamic number of photos into a new Mediashare gallery that is associated with the publication... from within the pagesetter/pgForms upload interface...

    -J

    --
    Burnham Racing
    Illinois Cycling Association
  • I think relations is probably the best way to do it.

    First, you create your 'master' document. Then in your document template, you have an inline publist to list all files associated with the master, and a "Add file" link to create a 'file document" with the relation field pre-set to the current document.
  • I thought about the relations route, but for my purposes (real estate) I want to keep all images withing the Pagesetter publication. That way, deleting the document deletes all of the images as well.

    With relations, the realtor would have to manually delete each and every photo by hand. Not an option :)

    Something that might work would be to have the images upload in the background to a temp directory and populate the image upload field with the location of the newly uploaded local file. Just an idea.

    ccandreva

    Can you describe what you mean by "asynchronous upload" ?


    Several uploading at the same time.
  • I have been eyeing JSupload: http://gwtupload.alc…pload/JsUpload.html

    It basically does what Darryl suggested -- it uploads the files into a hidden iframe. Once you select the first file to upload, it immediately starts the upload and you can continue to add more uploads to the queue.

    We just need to figure out how to get PS/pgForm to recognize the uploaded files and insert them into the appropriate fields. Looking at the docs, I don't think it would be too horribly difficult for someone with at least half an idea of how to do it. http://code.google.c…pload_Documentation
  • Thanks Wendell- I'll have to take a look at JSupload...

    For me having the photos not deleted isn't an issue but I do understand you concern...

    Ultimately if the uploaded images follow the Pagesetter naming convention (or even not though it would be harder) a custom workflow could be created to also delete the images... but that's a rather long solution...

    Really, the way I see it happening is to tear out the Pagesetter upload system and replace it with JSUpload or SWFUpload or another code set of similar function... thats a lot of work though.. I'm not sure I have the time or the skillset to surgically go at Pagesetter... I'm more of a cannon to kill a mosquito kind of guy ;)

    Maybe it would be wise to leave Pagesetter alone and focus on adapting/modifying/growing the mediashaare plugin so that from within a Pagesetter creation template (a pgForms template) a user could upload any number of images into a Mediashare gallery and then have that gallery "tagged" with the pid & tid of the publication. Then a simple "inline" gallery could be inserted into the publication referencing the pid & tid...

    I hacked a similar solution a while back- instead of the topics field for the Mediashare gallery I stuck in a list of all existing publications:

    Code

    <!--[elfisk_topicSelector2 id="keywords"]-->


    And then I replaced line 61 to the end in mediashare/elfisk/plugind/function.elfisk_topicSelector with this and saved it as function.elfisk_topicSelector2

    Code

    function smarty_function_elfisk_topicSelectorGetTopics()
    {
      pnModDBInfoLoad('Pagesetter');

      list($dbconn) = pnDBGetConn();
      $pntable =& pnDBGetTables();

      $topicsTable  = $pntable['pagesetter_pubdata4'];
      $topicsColumn = $pntable['pagesetter_pubdata4_column'];

      $sql = "SELECT pg_pid, pg_field12  FROM pn_pagesetter_pubdata4 ORDER BY pg_field12";

      $result = $dbconn->execute($sql);

      if ($dbconn->errorNo() != 0)
      {
        echo 'Elfisk "GetTopics" failed: ' . $dbconn->errorMsg() . " while executing: $sql";
        return null;
      }

      $topics = array();

      for (; !$result->EOF; $result->MoveNext())
      {
        $topics[] = array('id'    => intval($result->fields[0]),
                          'title' => $result->fields[1]);
      }

      $result->Close();

      return $topics;
    }


    And in the "Create album" template view, now instead of having a list of topics (which of course isn't needed in zikula) you have a list of all publication titles of a particular publication (in my case it's hardcoded to pub4...)

    And in the full template of publication 4 I have:

    Code

    <div align="center">
                    <div ><!--[ pnmodfunc modname=mediashare func=list key=$race tpl=profile order=modified orderdir=desc pageSize=50]-->
                </div>


    Which uses the key $race (the same field as pg_field12 above) to call Mediashare's list API and create a list of the images... Of course I did have to hack the Mediashare list API so that it could accept a value rather than the default 5... but that's a whole other bunch of hacks...

    ANyway, now a user creates a publication and then creates an album and assigns it to the previously created publication and in the publication full template the thumbnails (using lightbox) are displayed...

    SO....

    Couldn't we just make a Mediashare plugin to do this...

    ;)

    --
    Burnham Racing
    Illinois Cycling Association

This list is based on users active over the last 60 minutes.