Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Uncle Holden

Pages: [1]
1
My solution is essentially a hack, and its only redeeming feature is that it works. I made some ugly changes to /admin/images.php that are not extensible. I would rather wait until I have more time to polish it off and write down the steps, otherwise I will feel guilty for publishing something that may break or may be incompatible with other mods.

For those who want to see my solution, you can download the before and after files from here: http://dtabakov.com/dsplus/m.php?p=featured.zip.

Warning: this will not work "out of the box" because my code is talking to a database table that doesn't exist. In my version it is called 4images_featured and has three attributes: image_id (int 10), image_active (tynyint) and image_hits (int 10). Don't just copy these files over your existing files because you will break things. What I would suggest is running diff on the original files and the modified files and seeing where the changes were made. If you decide to play with this, do so on your own risk. If, on the other hand, something doesn't make sense, let me know and I will try to explain what I was trying to achieve.

2
I took a few shortcuts when implementing it so it might not be very extensible. If more people are interested I will write a step-by-step guide. Otherwise I can send you my "before" and "after" files and let you figure out what I have changed.

For the demo above, note that it also includes another MOD. Clicking on the rightmost third of the picture takes you to the next picture, the left third takes you to the previous, and the middle takes you to the page with the thumbs.

3
Well, it wasn't that hard to do. featured.php is essentially categories.php, except that the SQL code is modified to make a join with one more table.

display.php needs to be modified to display the name and a link the category from which the image is coming. Also, I added a link next to [Edit] and [Delete]: [Add to Featured]. On featured images it is replaced by [Remove from Featured]. Only admin can see those.

functions.php needs a slight tweak to return the proper links for the next and the previous images.

The usual suspects, constants.php and /lang/main.php also needed to be changed.

The code that handles the database manipulation is in /admin/images.php, and is a modification of the code to edit or delete an image.

Here is the final result for me: http://www.dtabakov.com/featured.php

4
Everybody keeps referring to "before the hack". Is there any information about what happened/whodunit? I am very curious.

It is time to start chopping then. Will see what I can do  :mrgreen: :mrgreen: :mrgreen:

5
I have been tinkering with this idea for a while. The problems is that I have 4000+ images on my site and everybody is so busy these days that they wouldn't have the patience to see more than a few categories. I want to show them my most impressive shots and hopefully give them enough incentive to dig deeper.

My idea is to add a separate "Portfolio" section where I will display my most impressive work. A few points in this direction:
  • No point duplicating images from /data. Probably it would be best to use a new table to store the image_ids of the selected shots and keep a separate hit count/vote count/rating. Comments/descriptions can be taken from the current images table.
  • Ideally add an option to "Add this image to portfolio" when logged in as an admin and looking at a picture
  • For each picture in the portfolio, add a link to the originating category
  • ...?

If people have further suggestions/ideas, please comment here. Also, if somebody with more PHP skillZ than me is interested in picking this up, it would be awesome. Otherwise I may be able to hack together something but it will be ugly.

6
Mods & Plugins (Requests & Discussions) / Re: Activate and deactivate
« on: February 15, 2006, 02:27:21 PM »
You can also do it using the database. In your favorite DB manager write

UPDATE `4images_images`
SET `image_active`=1
WHERE 'image_active' = 0;

and that will make all of your inactive images active again. If you want to do it for a specific category, add another condition to the WHERE clause:

UPDATE `4images_images`
SET `image_active`=1
WHERE 'image_active' = 0
AND 'cat_id' = 123456789;


7
Templates & Styles (Requests & Discussions) / Re: Quick Time Template
« on: February 13, 2006, 05:30:09 PM »
Same question. Maybe use the {image_width} and {image_height}?

8
http://www.4homepages.de/forum/index.php?topic=7368.0

There is no solution there, just the same question.

But technically it is possible. Just I don't know enough about the framework yet to tackle it myself.


9
Hehehe, I just dug out an old post that was requesting this same feature. It is possible to do. Users can upload new pictures, and fundamentally creating a new category is not that different.

10
Mods & Plugins (Requests & Discussions) / Users create their own categories
« on: February 03, 2006, 12:46:03 AM »
I have been thinking about this lately. From what I have seen so far in the framework, it seems that this is possible to implement. There is one small security issue because we implicitly give the users more access to the database. However, if we grant them upload permissions, that also allows them to change the database implicitly by adding new rows describing the new pictures. So, it is not a big security problem.

Here is my suggestion: add a new field in the categories table indicating that the category is open for creating subcategories by users. Optionally, add another field indicating how many new categories a user can have.

Add appropriate user interface for the user and the administrator.

Add code to handle the requests. Optionally, allow the user to create unlimited new categories in a category that they own.

If I see some free time, I may try to hack this together, but there are certainly more experienced 4Image hackers out there.

11
This is my first mod, be gentle.

Under the current setup to get to next/previous image you have to click on the link at the upper right/left corner or wherever your template puts it. I am proposing using an imagemap on the image itself to do the same thing. It allows the user to flip through the pictures faster, because they don't have to move the mouse  :D

Files to modify:
/includes/functions.php
/templates/<Your template>/details.html
/templates/<Your template>/jpg.html

Lets get started.

Step 1.
Backup everything!

Step 2.
Open functions.php

Find
Code: [Select]
    $site_template->register_vars(array(
      "media_src" => $media_src,
      "media_icon" => $media_icon,
      "image_name" => $image_name,

Insert after
Code: [Select]
      "third_width" => $width/3,
      "third_height" => $height/3,
      "two_thirds_width" => 2*$width/3,
      "two_thirds_height" => 2*$height/3,
      "category_index_url" => $site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id),

If everything is correct, the code immediately after should look like this
Code: [Select]
      "width_height" => $width_height,
      "width" => $width,
      "height" => $height,
      "iptc_info" => $iptc_info
    ));

If it isn't, don't worry about it too much, but do let me know what it looks like so that I can change the instructions accordingly.

Step 3.
Open details.html and insert immediately after
Code: [Select]
{header} the following snippet:
Code: [Select]
<!-- Allow navigation by clicking on the image -->
<div><map name="ee_multiarea" id="ee_multiarea">

<area
shape="rect" coords="0,0,{third_width},{height}"
{if prev_image_url}
  alt="Previous photo" title="Previous photo"
  href="{prev_image_url}"
{endif prev_image_url}
/>


<area
shape="rect" coords="{two_thirds_width},0,{width},{height}"
{if next_image_url}
  alt="Next photo" title="Next photo"
  href="{next_image_url}" style="cursor: e-resize;"
{endif next_image_url}
/>


<area
shape="rect" coords="{third_width},0,{two_thirds_width},{height}"
{if category_index_url}
  alt="Thumbnail page" title="Thumbnail page"
  href="{category_index_url}"
{endif category_index_url}
/>
</map></div>

Step Last.
Open jpg.html and change it from
Code: [Select]
<!-- Template file for JPG Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} ><br />

into this
Code: [Select]
<!-- Template file for JPG Files -->
<img src="{media_src}" border="1" alt="{image_name}"{width_height} usemap="#ee_multiarea" /><br />

If your file is different, just insert
Code: [Select]
usemap="#ee_multiarea" before the closing if the <IMG ... > tag.

This creates an imagemap on the pictures. Clicking on the left third will take you to the previous picture, the middle third takes you to the category page with the thumbs, and the right third takes you to the next picture.

If you are in the mood for experimenting, you can also use {third_height} and {two_thirds_height} to define some really sophisticated maps, but I prefer to keep it simple.

12
Mods & Plugins (Requests & Discussions) / Re: include php
« on: January 30, 2006, 02:50:18 PM »
The problem with PHP in templates is that the templates get parsed first. If you try to add PHP code for somthing like a counter, it probably won't work.

I was able to install a PHP counter (BBClone) by modifying the PHP files rather than the templates themselves. If this is what you are trying to do, send me a PM and I can give you more details.

Pages: [1]