boboldehampsink / zipassets

DEPRECATED - Zip Assets plugin for Craft CMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0 bytes zip files

johanneslamers opened this issue · comments

When I'm downloading a asset zip file.. the file size is 0 bytes.
And I can't open the zip.

What could be wrong?

this is my code:

<form method="post" target="_blank">
   <input type="hidden" name="action" value="zipAssets/download">
   <input type="hidden" name="filename" value="press_pictures_{{entry.slug}}">


   {% for asset in entry.persfotos %}
      <input type="checkbox" name="files[]" value="{{ asset.id }}"><!-- asset id -->
   {% endfor %}

   <input type="submit" value="Download!">
</form>

Do you use a multi-environment config?

ja. klopt.

Verstuurd vanaf mijn iPhone

Op 12 nov. 2014 om 08:32 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Do you use a multi-environment config?


Reply to this email directly or view it on GitHub.

Is een bekende bug, ben er mee bezig. Je kunt er voorlopig omheen werken door een absoluut pad te gebruiken.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/

iet • moen • die
Twents digitaal productiehuis

Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000 Enschede (The Gallery)
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente

Correcties en/of aanpassingen op uw bestaande website kunt u
mailen naar support@itmundi.nl mailto:support@itmundi.nl

On 12 Nov 2014, at 09:46, johanneslamers notifications@github.com wrote:

ja. klopt.

Verstuurd vanaf mijn iPhone

Op 12 nov. 2014 om 08:32 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Do you use a multi-environment config?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub #2 (comment).

geen haast. gaan pas live over 2 weken.

dank!

Verstuurd vanaf mijn iPhone

Op 12 nov. 2014 om 09:47 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Is een bekende bug, ben er mee bezig. Je kunt er voorlopig omheen werken door een absoluut pad te gebruiken.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/

iet • moen • die
Twents digitaal productiehuis

Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000 Enschede (The Gallery)
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente

Correcties en/of aanpassingen op uw bestaande website kunt u
mailen naar support@itmundi.nl mailto:support@itmundi.nl

On 12 Nov 2014, at 09:46, johanneslamers notifications@github.com wrote:

ja. klopt.

Verstuurd vanaf mijn iPhone

Op 12 nov. 2014 om 08:32 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Do you use a multi-environment config?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub #2 (comment).


Reply to this email directly or view it on GitHub.

Hi guys, same problem here. We use an environment variable to set our base path because we are working on a multilingual site. Using an absolute path could do the trick, but do you it is possible to parse the path to see if we have a variable in there, and inject it?
I'm sorry I'm totally new to Craft, I could probably fix it myself if I would knew it better ;)

Already found the solution? I'm now using craft 2.3

Sorry, haven't had the time yet! Its on my list tho

you're fast! Keep me in the loop.

Fixed in 1.2

Still the same problem.

Craft\AssetFileModel and its behaviors do not have a method or closure named "path".

This is my config file:

'environmentVariables'  => array(
            'basePath'          => BASEPATH,
            'siteUrl'           => SITE_URL,
            'uploadPath'        => IMAGEPATH,
            'path'              => IMAGEPATH
        ),

My assets settings
File System Path: {path}uploads/artist/

Asset field setting
Upload location: {slug}/press

Fixed in the latest release

Still zero byte zips. Used absolute path.

What path exactly?

On Thursday, December 11, 2014, johanneslamers notifications@github.com
wrote:

Still zero byte zips. Used absolute path.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

Asset souce file system path.

Field setting

Op 11 dec. 2014, om 20:50 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

What path exactly?

On Thursday, December 11, 2014, johanneslamers notifications@github.com
wrote:

Still zero byte zips. Used absolute path.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

Reply to this email directly or view it on GitHub #2 (comment).

Yeah I ment what is that path exactly?

And this was fixed when not using environment variables in your path?

Yes. All fixed. No environment variables.

Op 12 dec. 2014, om 15:46 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

And this was fixed when not using environment variables in your path?


Reply to this email directly or view it on GitHub #2 (comment).

Then there should be something wrong with your path. Can you debug $path on line 30 of ZipAssetsService, like this: Craft::dd($path); and see what it says? This should return the parsed path.

Gives me this:

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

This is the path of the asset folder

But the asset field settings point to above path + {slug}/press/

Op 12 dec. 2014, om 16:18 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Then there should be something wrong with your path. Can you debug $path on line 30 of ZipAssetsService, like this: Craft::dd($path); and see what it says? This should return the parsed path.


Reply to this email directly or view it on GitHub #2 (comment).

So {slug}/press/ gets deleted? And if you dump $path before line 29?

On Friday, December 12, 2014, johanneslamers notifications@github.com
wrote:

Gives me this:

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

This is the path of the asset folder

But the asset field settings point to above path + {slug}/press/

Op 12 dec. 2014, om 16:18 heeft Bob Olde Hampsink <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> het volgende
geschreven:

Then there should be something wrong with your path. Can you debug $path
on line 30 of ZipAssetsService, like this: Craft::dd($path); and see what
it says? This should return the parsed path.


Reply to this email directly or view it on GitHub <
https://github.com/boboldehampsink/zipassets/issues/2#issuecomment-66785462>.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

Undefined variable: path

Op 12 dec. 2014, om 16:49 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

So {slug}/press/ gets deleted? And if you dump $path before line 29?

On Friday, December 12, 2014, johanneslamers notifications@github.com
wrote:

Gives me this:

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

This is the path of the asset folder

But the asset field settings point to above path + {slug}/press/

Op 12 dec. 2014, om 16:18 heeft Bob Olde Hampsink <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> het volgende
geschreven:

Then there should be something wrong with your path. Can you debug $path
on line 30 of ZipAssetsService, like this: Craft::dd($path); and see what
it says? This should return the parsed path.


Reply to this email directly or view it on GitHub <
https://github.com/boboldehampsink/zipassets/issues/2#issuecomment-66785462>.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

Reply to this email directly or view it on GitHub #2 (comment).

Sorry, try this on that place: Craft::dd($source->settings['path']);

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

I get this

Op 12 dec. 2014, om 17:22 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Sorry, try this on that place: Craft:dd($source->settings['path'])


Reply to this email directly or view it on GitHub #2 (comment).

Then it seems there is no variable in there at all?

On Friday, December 12, 2014, johanneslamers notifications@github.com
wrote:

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

I get this

Op 12 dec. 2014, om 17:22 heeft Bob Olde Hampsink <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> het volgende
geschreven:

Sorry, try this on that place: Craft:dd($source->settings['path'])


Reply to this email directly or view it on GitHub <
https://github.com/boboldehampsink/zipassets/issues/2#issuecomment-66795302>.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

No slug.

/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/{slug}/press needs to be the location.

{slug}/press is the config of the asset field.

/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

Op 12 dec. 2014, om 17:43 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Then it seems there is no variable in there at all?

On Friday, December 12, 2014, johanneslamers notifications@github.com
wrote:

'/WWW/A/.5c2/r/roordink/htdocs/uploads/artist/‘

I get this

Op 12 dec. 2014, om 17:22 heeft Bob Olde Hampsink <
notifications@github.com
javascript:_e(%7B%7D,'cvml','notifications@github.com');> het volgende
geschreven:

Sorry, try this on that place: Craft:dd($source->settings['path'])


Reply to this email directly or view it on GitHub <
https://github.com/boboldehampsink/zipassets/issues/2#issuecomment-66795302>.


Reply to this email directly or view it on GitHub
#2 (comment)
.

Met vriendelijke groet,

Bob Olde Hampsink

http://www.itmundi.nl/ iet • moen • die
Twents digitaal productiehuis Albergen (HQ)
Zandhuisweg 2
7665 SH Albergen
Tel. 0546 535000_Enschede (The Gallery)_
Hengelosestraat 500
7521 AN Enschede
Kennispark Twente Correcties en/of aanpassingen op uw bestaande website
kunt u
mailen naar support@itmundi.nl

Reply to this email directly or view it on GitHub #2 (comment).

What if you add this on line 30:

$path = craft()->templates->renderObjectTemplate($path, $asset);

check it on monday.

Verstuurd vanaf mijn iPhone

Op 13 dec. 2014 om 14:50 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

What if you add this on line 30:

$path = craft()->templates->renderObjectTemplate($path, $asset);


Reply to this email directly or view it on GitHub.

Still zero byte zips

This is the code now:

elements->getCriteria(ElementType::Asset); $criteria->id = $files; $criteria->limit = null; $assets = $criteria->find(); // Set destination zip $destZip = craft()->path->getTempPath() . $filename . '_' . time() . '.zip'; // Create the zipfile IOHelper::createFile($destZip); // Loop through assets foreach($assets as $asset) { // Get asset source $source = craft()->assetSources->getSourceById($asset->sourceId); // Get asset path $path = craft()->config->parseEnvironmentString($source->settings['path']); $path = craft()->templates->renderObjectTemplate($path, $asset); // Add to zip Zip::add($destZip, $path.$asset->filename, $path); } // Return zip destination return $destZip; } ``` } > Op 15 dec. 2014, om 09:15 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven: > > Reopened #2 https://github.com//issues/2. > > — > Reply to this email directly or view it on GitHub https://github.com//issues/2#event-207463820.

Mmm weird. You're gonna have to send me the Craft & FTP credentials for me to be able to debug this.

Can you send me you email?

Op 15 dec. 2014, om 13:16 heeft Bob Olde Hampsink notifications@github.com het volgende geschreven:

Mmm weird. You're gonna have to send me the Craft & FTP credentials for me to be able to debug this.


Reply to this email directly or view it on GitHub #2 (comment).

Fixed in 1.3.0