Hello all, thanks for the new feature 'Custom Thumbnail' , it's cool.
But could you tell me where are stored the actual uploaded files ? Or even better, how can I call the file for a given album on a page (not the thumbnail but the original file) ?
Thanks.
Posts: 7994
The uploaded files are stored in g2data/plugins_data/modules/thumbnail
Not really sure what you're asking here. Can you elaborate?
Posts: 30
For each album (as well as nested album), I am going to upload a picture file for the custom thumbnail.
For the uploaded files, I'm thinking of using the following naming convention : albumName_header.jpg
On each album's homepage (i.e. albumBody.tpl), I want to display the corresponding uploaded picture (not the thumbnail) as a banner.
(here's an example in G1 : http://server101.totalchoicehosting.com/~severyn/gallery/aero)
I could use code like this :
<img src="{g->url href="www.myserver.com/g2data/plugins_data/modules/thumbnail/`$nameOfTheAlbum`/_header.jpg"}"/>
For such line of code, what's the correct variable name :$nameOfTheAlbum ?
Or, maybe, there's already a variable which points to the corresponding file, which would spare me from truncating the name with '_header.jpg'.
In this case, the code would look like :
<img src="{g->url href=$pathToCustomPicture}"/>
I hope all this makes sense...
[/code]
Posts: 8601
in layout.inc do this:
then in your tpl you can do:
Posts: 30
Thank you Mindless (you're on every thread !).
I get a parse error (unexpected T_STRING) on layout.inc
I am way too ignorant to see if there's a typo in your code, or if it's something else...
Posts: 8601
please look at the code I posted and integrate it appropriately rather than just copy/paste... i'm assuming you have enough understanding of layout.inc so you can find the right place to add that code (ie, somewhere where $layout is available).
and either you can decipher any error msg from php or you'll need to post more detail than "unexpected T_STRING"...
Posts: 30
It is embarrassing, but no, I don't really understand how layout.inc works, nor do I understand your code (again, I know html & css, that's it).
here are parts of my layout.inc file, so you'll see where I put your code.
The parse error is :
Parse error: parse error, unexpected T_STRING in /home/severyn/public_html/gallery2/layouts/darkglass/layout.inc on line 173
And at the end of the file :
Posts: 8601
1) remove the funny binary characters that got into your layout.inc from your copy/paste.
2) move the "if (isset" block from where you have it now to where you currently have the other block.
3) move the relativeRequireOnce to the top of loadTemplate
4) put 2 copies of the fetchThumbnail and subsequent error check into the getCanContainChildren() if block... one for albums and one for items.. in the album block use $item->getId(), in the item block use $item->getParentId().. that way when you're viewing a photo it will load the header image for the parente album.
Posts: 30
I still have the same error. I think I followed your directions correctly :
Posts: 8601
just move the fetchThumbnail/error-checks above the _loadAlbumTemplate/_loadSingleTempate calls and you'll be done (so the error check below that if block will still work)
Posts: 30
OK, no more error message, but the img doesn't come up. I get the following html code :
<img src="http://www.myserver[edited].com/g2data/plugins_data/modules/thumbnail//_header.jpg?g2_GALLERYSID=b0a7329b0b5934ec30df49bfd91e0b8d"/>
Posts: 8601
1) manually retype the section you have commented in layout.inc (setting 'headerImage'), but don't comment out this time.
2) delete the commented lines, which include some binary characters
3) manually retype the headerImage section in your albumBody.tpl
4) delete the current headerImage section which has a binary character
Posts: 30
it's getting better, but still no picture : the img block shows, as well as the alt text, but not the jpg.
the html source is :
<img src="http://www.myserver.com[edited]/gallery2/main.php?g2_view=core:DownloadItem&g2_itemId=201&g2_serialNumber=1&g2_GALLERYSID=d5ab8a6c8941814d17fcac5bb3e353bf" width="750" height="236" alt="chambord_header.jpg"/>
thank you for being so patient.
Posts: 8601
1) probably a good idea to use <!-- and --> around html comments.. i'm not sure, but the extra --'s may confuse some browsers
2) oops, I forgot the full size custom thumbnail file is only given permission for Site Admins when it is created.. if you want to use it in this way you need to add additional permissions.. there is no UI for this.
you can edit your modules/thumbnail/classes/ThumbnailHelper.class function addItem, where it gets id.adminGroup change it to id.everybodyGroup and then any new custom thumbnails you add will have public access.. you'll need to remove and re-add your existing custom thumbs.
Posts: 30
We're done ! It works !
Thanks again for all your help and patience. Now I'll try to finish my custom layout and post it as soon as it's ready.
Didn't even have to remove and recreate the existing custom thumbs.
Take care.
:cry:
[EDIT]
Scratch that...
I just went back on the pages and the images are no longer there. I tried to remove and recreate custom thumbs but I get a Fata error :
Posts: 8601
1) what change did you make to ThumbnailHelper.class? I still see id.adminGroup on your site.
2) what's your G2 version? the latest ThumbnailHelper.class doesn't have that convertExtensionToMime call.
Posts: 8601
you appear to have a mix of old and new files on your site.. use the manifest check in upgrader step 2 to make sure you have a valid codebase.
Posts: 30
I had B2 (first release -- 0.9.10) installed. Just upgraded to current B2 (0.9.14) and edited ThumbailHelper.class via cpanel.
It now works.
Just a quick question : it seems I can't select a Custom Thumbnail for my main gallery (the home page). I can create another layout just for this page (without the custom thumbnail code). Would you have another trick ?
Re. the mixed files : I'm not sure if I do the right thing : I usually ftp the tar.gz file on my server, extract it with cpanel and then run the upgrader.
Posts: 8601
if you remove the $item->getParentId() > 0 check from function isAppropriate in modules/thumbnail/CustomThumbnailOption.inc then the form will appear even for the root album.. (normally we hide it since you can't see a thumbnail for the root album anywhere...)
yup, that's the right way to upgrade..
Posts: 30
Just a quick note to Mindless : I'm almost done with my custom G2, thanks to you !
Here it is :
http://www.severyns.com/gallery2
I still need to work on some details and the admin layouts, but I got what I wanted. I'll be glad to post the files when it's done.
Cheers.
Posts: 32509
fly.cub, showing an image in the album description is a good idea, looks great, eg. http://www.severyns.com/gallery2/main.php?g2_view=core:ShowItem&g2_itemId=395
did you just add html img code to the description field?
Posts: 8601
valiant, no.. the tpl is referencing the ThumbnailImage of the custom thumbnail for the album (the ThumbnailImage has the image that was uploaded in its original size, which is used as the source image for the album thumbnail.. I helped fly.cub to access this object directly....)
Posts: 30
credit for the idea should go to http://www.frommel.net/gallery : it's a G1 design.
The author never shared his G1 templates so I started from scratch in G2.
Posts: 70
This works in 2.1 rc1 as long as you keep with the new api changes like
$ret->isError()
changes to
$ret
ps. Thanks Mindless for the great help.
|| G1 Hosting | Custom Theming | Donate to Gallery ||
Posts: 8601
there is a mention of the permissions thing above... http://gallery.menalto.com/node/29086#comment-104201