boboldehampsink / zipassets

DEPRECATED - Zip Assets plugin for Craft CMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zip file empty on creation

siebird opened this issue · comments

Thanks for sharing this plugin! I'm having an issue getting the zip file to include the asset files on creation. Currently all zip files are zero bytes. This what I currently have:

<form method="post" target="_blank">
    <input type="hidden" name="action" value="zipAssets/download">
    <input type="hidden" name="filename" value="hph-documents">

    <table class="agent-table">
        <thead>
            <tr>
                <th>Type</th>
                <th>Document Name</th>
                <th>View</th>
                <th>Zip</th>
            </tr>
        </thead>
        <tbody>
            {% for floorplan in craft.entries.section('floorplans').order('title') %}
            <tr>
                {% if loop.first %}
                <td rowspan="{{ loop.length }}" valign="top">
                    Floorplans
                </td>
                {% endif %}
                <td>
                    {{ floorplan.title }}
                </td>
                <td>
                    {% set flyer = floorplan.printableFlyer.first() %}
                    <a href="{{ flyer.url }}" class="btn">View</a>
                </td>
                <td>
                    <input type="checkbox" name="files[]" value="{{ flyer.id }}">
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <p><button class="pull-right" type="submit">Zip Files</button></p>
</form>

Looks perfectly fine to me. Are you skilled in PHP, and able to debug it this yourself in the plugin?

Not confidently–I can kind of follow what's going on but can't tell where it's breaking. When I run the form to zip the files, it seems to be completing too fast. View here: http://stage.hphpa.com/agents

Can you add this to line 27 of ZipAssetsService.php and run it again?

Craft::dd($source->settings['path'].$asset->filename);

Then tell me what you see

I had a hunch it was that. I'm using Craft's multi-environment configs & variables to set paths based on the environment.

'{basePath}/media/docs/HPH-Vision-and-Energy-Monitoring-Description.pdf'

If I hard code in the path in the CP, it works. Any ideas on how to keep the multi-environment settings?

Nice find, thanks. I will fix it for you, so you can keep your environment variables.

For now, I recommend using a hard coded path on your live env.

Awesome, and thanks for sharing this plugin!

This has just been fixed in 1.2