Jump to content

Richard Jedlička

Members
  • Posts

    100
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Richard Jedlička

  1. Hi, thanks for the reply. I haven't tried the PW 2.6 yet. The reason why I used image inputfield is to render the PDF thumbnails exactly the same way as images. But maybe you are right, I should have used my own render method. I'll check it out.

    • Like 1
  2. Here is my proposal. The HTML is in attachments.

    There are multiple ways how to install the module.
    
    Installing from directory (recommended)
    --------------------------------------
    
    If the module is uploaded in the official *ProcessWire Modules/Plugins Directory* (http://modules.processwire.com), you can use this method.
    
    1. Log in to your ProcessWire admin and go to the *Modules* page.
    2. Go to the *New* tab and expand the *Add Module From Directory* section.
    3. Enter the *Module Class Name* (can be found in the module's detail page, e.g. FieldtypeMapMarker).
    4. Click the *Download and Install* button.
    
    Installing from URL
    -------------------
    
    If the module is not in the official *ProcessWire Modules/Plugins Directory* (http://modules.processwire.com), but the module ZIP is accessible from URL, use this method.
    
    1. Log in to your ProcessWire admin and go to the *Modules* page.
    2. Go to the *New* tab and expand the *Add Module From URL* section.
    3. Enter the *Module ZIP file URL* (can be found in the module's detail page, e.g. https://github.com/ryancramerdesign/FieldtypeMapMarker/archive/master.zip).
    4. Click the *Download* button.
    5. The downloaded modules are now listed on top of the page. Click the install button next to any of the new modules that you want to install.
    
    Installing from upload
    ----------------------
    
    If the module ZIP file is not accessible from web or you have it already downloaded, you can upload the file.
    
    1. Log in to your ProcessWire admin and go to the *Modules* page.
    2. Go to the *New* tab and expand the *Add Module From Upload* section.
    3. Select the *Module ZIP file*.
    4. Click the *Upload* button.
    5. The uploaded modules are now listed on top of the page. Click the install button next to any of the new modules that you want to install.
    
    Installing manually
    -------------------
    
    If any of the above methods isn't suitable for you, you can install the module manually.
    
    1. Place the .module file in your /site/modules/ directory. If the module contains more than one file (like supporting .css or .js files for example), it should be created in it's own directory under /site/modules/ with the same name as the module (.module file). For instance, the FieldtypeMapMarker module and supporting files should be placed in /site/modules/FieldtypeMapMarker/.
    2. Log in to your ProcessWire admin and go to the *Modules* page.
    3. Click the *Check for New Modules* button.
    4. New modules are now listed on top of the page. Click the install button next to any of the new modules that you want to install.
    
    *Note: All third party modules should be placed in /site/modules/. You might also notice that ProcessWire keeps core modules in /wire/modules/ – You should avoid installing your modules there, as that location is reserved for core modules.*
    
    How to uninstall a module
    -------------------------
    
    1. Log in to your ProcessWire admin and go to the *Modules* page.
    2. Find and click the module name that you want to uninstall.
    3. Expand the *Uninstall* section, check the checkbox.
    4. Click the *Submit* button.
    5. It is now safe to remove the module's files from /site/modules/ if you want to.
    

    how-to-install.html

    • Like 8
  3. Hi, I think that the page http://modules.processwire.com/install-uninstall/ should be updated according to the current PW's capabilities (Add module from directory/URL/upload). I'm writing this because it would be much better to have the instructions in one place instead of writing them to each module's readme. I'm not sure who is responsible for the content of the page, Ryan? I can update the text if you want, or at least write the proposal.

  4. Hi,

    it looks that only minimum of people there care about this. If the PW's license is GPL v2, what license the module is allowed to be? E.g. if I derive Pagefile class, may the derived class be licensed under MIT (or any other), or it must also be under GPL v2 license?

    Thanks

  5. Hi,

    this tool is really cool idea. It would be great to have command for full PW installation, not just download. I've managed it by modifying original install.php file from PW 2.5 sources. But I'm not sure if it is production ready, it works but I haven't tested all edge cases. It requires config file with configuration array (db connection, profile, admin user credentials, ...). If you are interested I can post it somewhere. I plan to do it also for PW 2.4. With this comes and idea for 'new' command to allow installation of another versions other than the latest.

    EDIT:

    ... So it will be a a one click installer.

    Hari KT, don't you have the same intention? What do you mean by 'one click installer'. Installer for wireshell or for PW?

  6. Hi,

    I'm just trying to delete file field via API. I want to delete it completely without concerning which pages is using it. I found this code:

    $fields = wire('fields');
    foreach ($fields->find('name=field_name') as $field) {
    	foreach ($field->getFieldgroups() as $fieldgroup) {
    		$fieldgroup->remove($field);
    		$fieldgroup->save();
    	}
    
    	$fields->delete($field);
    }
    

    This removes the field from database it is OK. But it doesn't remove the files (from filesystem) that ware added to pages.

    As I was going through PW source code I've found that I have to save the page also, but it really complicates the thing. The problem starts in FieldtypeFile::___deletePageField method where the $pagefile is handled differently according to field output formatting. If the $pagefile is PageFile, the unlink is called which also deletes the file from filesystem. If the $pagefile is PageFiles the deleteAll is called which only adds hooks on page save. Why is it done this way? This makes inconsistency when deleting the field. Is there some better way to delete the field without caring about pages?

  7. Hi Mike,

    I haven't seen this GS error before. I'm not an expert in Ghostscript nor ImageMagick, I have just go through many internet discussions and found working php code for pdf to image conversion. But as you say, it looks like a GS bug.

    I also got an error saying "Field "certificate_pdf" is not yet ready to use and needs to be configured." I don't quite understand what needs to be configured...

    This is one of the issues in PW 2.5 as I mentioned earlier. See https://github.com/uiii/ProcessWire-FieldtypePDF/issues/6. If you want, you can temporarily use  somatonic's fork or wait for my upgrade. 

  8. Hi Mike,

    I'm not sure if there is some minimal version of ghostscript needed. I have installed ghostscript 9.15 with imagemagick 6.9.0 and according to phpinfo the php's imagick module is of version 3.1.2. In this configuration everything works fine.

    No binaries are executed directly from php, the php's imagick module is used (imagick.so in php.ini), but you must have installed ghostscript and imagemagick as a system package.

    Hope this helps you.


    BTW: If you are going to use this module on PW 2.5, you will probably get some errors. I'm working on that and hope to finish it this week. PW 2.4 should be ok. 

  9. Fine, thanks. I'll update the module soon.
     

    Just an FYI - I created a similar module a long time ago that I haven't ever got around to finalizing for release:
    https://github.com/adrianbj/ProcessPDFImageCreator


    Yes, I've found it and got a little inspiration. Originally I wanted to use it, but I don't like it requires exact, properly named fields to work. And conversion of the whole PDF isn't my need, just the first page thumbnail. But based on this a got an idea to add optional parameter to the thumbnail method specifing the page number to convert.

  10. Hi, thanks for the replies. :-)
     

    I think you should note somewhere is the requirement for imagemagick, ghostscript, and the imagick extension ...

     
     Yes, that's right. When and how is the proper way to print this error?
     

    $imagick->setOption("pdf:use-cropbox","true");
    $imagick->setColorspace(Imagick::COLORSPACE_RGB);
    Also, if you find that the colors in the image are not matching those in the PDF, this gives instructions on the changes that need to be made to your imagemagick delegates file: http://www.lassosoft.com/CMYK-Colour-Matching-with-ImageMagick

     
    I haven't much experience with ImageMagick. I've just found somewhere the code snippet of "pdf to image" conversion and use it. What consequences will have these two options? 
     
    The "delegate" thing - I think it's not related to the module itself.
     

    $this->addHook("Pagefile::thumbnail", $this, "thumbnail");
    
    public function thumbnail($width, $height) {}

    Hey, I didn't know that it's so simple :-). If it's better or not I don't know, maybe the class is more suitable for future module's extensions.

    • Like 1
×
×
  • Create New...