Pages (2): 1 2   
Member
Member
mlodszy   2013-02-07, 18:20
#1

Hi,
I'm writing an plugin that create an image from first page pdf, eps files to preview what is in document. After some review I used class-WEBdocs as base of new one.

I have:

  • upload
  • checked function of generating image(by ghostscrip)

In class-WEBdocs use static images, but I want to generate a thumb of image which will be stored in directory. Is there a class for it and can you indicate in which file is used?

Other thing - is there any place to disable scaning for images placed in directory, in albums? (/albums/sample_direcotry)

Member
Member
sbillard   2013-02-07, 18:38
#2

Do you want to generate a thumb for each document or just a different default thumb? For the former, just place the generated thumb in the folder. The filename of the thumb should be the same as the document except that the suffix should be that of an image rather than pdf. If you want to have a different default thumb, create that image and place it in your plugins/class-WEBdocs folder. Name it pdfDefault.png.

There is a plugin that will disable scanning of folders and/or file suffixes. It is named filter-fileSearches and may be found in our repository of unsupported code on GitHub.

Administrator
Member
Member
mlodszy   2013-02-07, 18:46
#4

I want to generate thumb for each document. Like I'm write for each file I will generate full size preview image of first page document and stored it on the disc.

Member
Member
mlodszy   2013-02-07, 19:43
#5

@acrylian thanks. If i think good i need only place image in the same direcotry that file and name it with the same name, with lower case?

Then I must in "function getThumbImageFile" indicate on this file?

Administrator
Administrator
acrylian   2013-02-07, 19:54
#6

As the article tells the image must have the same name as the actual file except the suffix naturally. This way works with all supported formats via plugins like videos, text objects or the webdocs without needing to indicate anything.

Member
Member
mlodszy   2013-02-07, 20:00
#7

Thank you for your time

Member
Member
mlodszy   2013-02-08, 12:55
#8

After some work and testing I came with one problem - getting a full path to file.

$filename = $this->filename;
$album = $this->folder;
$ff_src_file = $_SERVER['DOCUMENT_ROOT'] . '/' . $albums . '/' . $filename;

But have an error with
NOTICE: Undefined property: EXTdocs::$folder in /zp-core/zp-extensions/class-EXTdocs.php on line 138 EXTdocs->getThumbImageFile called from TextObject->getThumb (class-textobject_core.php [162]) from getImageThumb (template-functions.php [2627]) from printImageThumb (template-functions.php [2645]) from include (album.php [56]) from index.php [100]
Have you mayby some good solution for get the right path?

Administrator
Administrator
acrylian   2013-02-08, 13:16
#9

$filename = $this->filename; $album = $this->folder;
That cannot work, first $this is a variable within a class and then images and albums are different objects. EIther it is an album object or an image one. In any case filename and folderwon't work on both.
Please read: http://www.zenphoto.org/news/zenphotos-object-model-framework
and review the documentation of the main Zenphoto classes. If you haven't you should read the theming tutorial as well.

If you just want the full image url there are template functions available.

Member
Member
mlodszy   2013-02-08, 13:59
#10

`
and review the documentation of the main Zenphoto classes. If you haven't you should read the theming tutorial as well.

If you just want the full image url there are template functions available.
You don't understand. I don't use this in theme but in class. I sed: full path to file. Not url - i need something like /home/some/some/albums/test`

Administrator
Administrator
acrylian   2013-02-08, 14:09
#11

What class do you use this in? $this refers to the class object itself. In any case that NEVER can be an image object or an album object at the same time.

home/some/some/albums/test
What is "some" here?

You get the url to an item (which refers to any supported items) within an album via getFullImageURL() if in the right context. Otherwise you need to create an image object first to use the method. Before you can create an image object you need the object of its album. That is explained on the object model tutorial.

If this file is outside the albums and not supported by a plugin like videos you cannot use the object model naturally.

Member
Member
mlodszy   2013-02-08, 14:27
#12

I use: class-textobject_core
I base plugin on: class-WEBdocs
I want to get:
SERVER_DOCUMENT_ROOT/BASE_ALBUM_DIR/ALBUMS/Filename

Like I write above, I want to create an image from uploaded file. For that I need to tell ghostscript from where get file and where storage image file.

Administrator
Administrator
acrylian   2013-02-08, 14:34
#13

The textobject class is an extension of the image class and inherits its methods. So the url will be $this->getFullimageURL().

Member
Member
mlodszy   2013-02-08, 14:44
#14

I sed above - i don't need FileURL(http://) - i need path (/home/path)

Administrator
Member
Member
mlodszy   2013-02-08, 18:38
#16

Thanks! I got all worked up now

After some improves in code, I want to publish for other. Can you say how/where send/publish, so that others also have the chance to use?

Administrator
Administrator
acrylian   2013-02-08, 19:04
#17

Please see: http://www.zenphoto.org/news/general-contributor-guidelines

Member
Member
mlodszy   2013-05-23, 18:17
#18

I manage to create class (based on other one) that generate pdf/eps/tiff preview. It's have some code to improve/erase but working well.

If someone need, find here: http://pastebin.com/J7iJcWZG

Mayby one day I have time to finish it or mayby someone do it for me

Administrator
Administrator
acrylian   2013-05-23, 18:42
#19

Is that a static link so we can add it to the extensions section?

Member
Member
mlodszy   2013-05-23, 20:08
#20

Yes, it's static. There will be no change and have life time set to forever

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.