• [MOD] Multi Size Download of same image [ver 4.7] 5 0 5 1
Currently:  

Author Topic: [MOD] Multi Size Download of same image [ver 4.7]  (Read 432943 times)

0 Members and 1 Guest are viewing this topic.

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #165 on: July 03, 2010, 08:26:09 PM »
@ batu544,
I looked around your site and did not see this error anywhere...
Most of the time when I have seen this error, it is because of something not being correct in the .htaccess file but I do not work with them to help you fix the problem.

I did see your post with V@no regarding my mod not using the site_sess->url correctly,
I am currently fixing my user category mod to hopefully work correctly with the sessions and then I will be tackling this mod to see if that may be your issue or not.

Sorry I could not be of more help,
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #166 on: July 03, 2010, 09:53:32 PM »
I am currently fixing my user category mod to hopefully work correctly with the sessions and then I will be tackling this mod to see if that may be your issue or not.

A little tip to make it fully compatible with integrations and avoid common mistakes, in case you didn't know:
- url passing to $site_sess->url() functions must have & not &
- url queries for image_id, user_id, cat_id, etc should be replaced by constants URL_IMAGE_ID, URL_USER_ID, etc (refer to includes/constants.php)
for example line:
	
	
	
	
	
	
	
$multi_download_group .="<td align='center'><a href='".ROOT_PATH."download.php?action=resize&amp;image_id=".$image_row['image_id']."&amp;multi_download_select=".$var."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";


should look like this:
	
	
	
	
	
	
	
$multi_download_group .='<td align="center"><a href="'.$site_sess->url(ROOT_PATH."download.php?action=resize&".URL_IMAGE_ID."=".$image_row['image_id']."&multi_download_select=".$var).'"'.$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #167 on: July 04, 2010, 12:21:31 AM »
V@no -
            Do you think putting &amp; in the url() function will cause a problem ?? I have not done this changes but still its working.. and also I noticed there is a line in the url() function..
Code: [Select]
$url = str_replace('&amp;', '&', $url);

Is this not to replace &amp; with '&' ??


Budduke -
                   The Hot link error message comes in, if one person is bookmarking one image download page and he comes later to visit that page. For example if you will visit this page now then you will get the hotlink error message

http://www.bhwallpapers.com/download-kim-kardashian-20592-13-1280x800.htm

but if you will visit the same page by visiting wallpapers detail page --> download page.. it will not give you any error message..

The error message comes up from the following lines of code in download.php

Code: [Select]
    if (!check_download_token($image_row['image_id'])) {
      echo "Hotlinking is not allowed";
  exit;
  redirect("index.php");
    }


Thanks
batu544


Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #168 on: July 04, 2010, 12:42:14 AM »
@ batu544,

I think this should fix your problem...
http://www.4homepages.de/forum/index.php?topic=23530.0

I believe 4images does this by design, to stop other sites from using your bandwidth by directly linking to your download images and not going through your details page.

Your download image page is unique in that it still has ads on it. If you are going to allow other sites to link this way to you, you should put something like...
"To see more images like this visit my main site at Bollywood Hollywood Celebrity wallpapers (with a link)"
Just a thought...

@ V@no,
Thank for the input, like usual, I do forget about the constants. Am currently waiting to see how my fix worked on my other mod before working on this one again.
I do not really understand how the site_sess->url() works but all I know is that it does work. It added the &l=language on all the links on my other mod but not sure how...
Maybe someday I will understand it better.
Thanks again!
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #169 on: July 04, 2010, 01:33:59 AM »
            Do you think putting &amp; in the url() function will cause a problem ?? I have not done this changes but still its working..
It could cause problems with a SEO mod.

and also I noticed there is a line in the url() function..
Code: [Select]
$url = str_replace('&amp;', '&', $url);
There is no such line in fresh 4images ;)


As of hotlinking, you have two options:
1) disable hotlinking protection:
in includes/functions.php find:
function check_download_token($token) {
insert below:
  return true;

2) simple redirect to image details page:
in download.php replace:
      echo "Hotlinking is not allowed";
with:
      redirect("details.php?".URL_IMAGE_ID."=".$image_row['image_id']);
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Multi Size Download of same image [ver 4.2]
« Reply #170 on: July 04, 2010, 07:43:12 AM »
V@no -
            I used option 1 .. :) and its working fine..

and you are correct the above lines of code is not in the fresh 4image installation, but its actually a part of the Google Friendly Urls For 4images Best Seo Mod.


Thanks
batu544

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #171 on: July 04, 2010, 06:47:26 PM »
The problem with the sessions should be fixed now with version 4.3 of my mod.
you only have to replace one insert area of my code to fix the problem.
Sorry about that...

Thank V@no for your input!

I am still learning from the best  :D
Buddy Duke
www.budduke.com

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #172 on: July 07, 2010, 08:04:22 AM »
Hi Budduke,
                     I had a discussion with V@no regarding one change and as per V@no, this can be done by you :)

For details about the question..  ==> http://www.4homepages.de/forum/index.php?topic=17598.msg148750#msg148750


For suggested solution ==> http://www.4homepages.de/forum/index.php?topic=17598.msg148764#msg148764
Quote
@batu544:
The problem is, neither the multi size download, nor this mod has actual image dimensions.
I think your best bet would be ask budduke to add additional item into $download_multi_sizes array that would temporary hold original image dimensions.


Is it doable ?

Thanks,
batu544

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #173 on: July 08, 2010, 12:11:12 AM »
@batu544 and V@no,
Not sure what you are asking?
In the $download_multi_sizes array...
the first variable is what is displayed
the second variable is the x dimension
the third variable is the y dimension

The image dimensions are already there  :?

For the original image, it is choosing the next variable in the array that actually does not exist so the code knows to pull the original file instead.
Are you wanting one more variable with the x&y dimensions of the original file in it for some reason? That may be possible but would have to rewrite some of the code to make it work.

Let me know more what you are trying to accomplish and then I will go from there...

UPDATE:
Reread your other posts and I wonder if it could be this easy?
in your includes/functions.php file
look for
Code: [Select]
$varcount= count($download_multi_sizes);Replace with
Code: [Select]
//$varcount= count($download_multi_sizes);
$original_number=30;//Make this # the same as what shows up in the link for 'original size' after 'multi_download_select='
$download_multi_sizes[$original_number][0]=$lang['original_size'];
if ($detailed_view){
$download_multi_sizes[$original_number][1]=$max_width;
$download_multi_sizes[$original_number][2]=$max_height;
}
$varcount= count($download_multi_sizes)-1;

Make sure you change the original_number to what you need on your site...

It seems to work on my test site but I am worried about all the random images on your details page because this is called each time but I think I made sure only the main one will be stored and not any of the other thumbnails...
« Last Edit: July 08, 2010, 12:58:26 AM by budduke »
Buddy Duke
www.budduke.com

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #174 on: July 09, 2010, 02:22:24 AM »
No, it's not that, your addon doesn't get any information about the image itself, batu544 asked for actual image dimensions.
And besides, I think this additional code will break your mod, because you don't have static number for original size, you are using the count($download_multi_sizes) for the original size. So, if you have 29 items in that array, then number 30 would be original and then if you add key 30 into that array with info about original image, then count($download_multi_sizes) will return 31, which will make original image size 31 not 30 (IMO it's a flaw of this mod ;))
If I may suggest, instead of using dynamic number for original image, use static, such as 0:
$download_multi_sizes= array(
	
array(
'0x0',0,0), //original image, the numbers don't matter
	
array(
'group1',0,0), //Groups are created in this format, group1 name is associated with a language entry with the same name (the 0,0 is important!)

and then use $var=1; to skip original array key..
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #175 on: July 09, 2010, 02:37:32 PM »
@ V@no,
Actually, It doesn't break the code in any way because on the count, I subtracted one from it so it will not get in the way.
When the mod first started way back when, it did not have original size in it so it was added after the original code. I guess sometimes it is better to start the code all over then to keep patching the one already made. If I put the original as the first variable, that is asking for a user to mess it up in some way but this way they do not see it is there.
I may implement it into the mod because then I could have the original image size displayed next to the word in case someone sees a need for it.

Thanks for you help and advice and it looks like Batu544 has the problem taken care of...
Buddy Duke
www.budduke.com

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #176 on: September 26, 2010, 02:27:11 PM »
i'm getting this on detail page.

Code: [Select]
DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name, u.user_email, c.multi_downloadage_votes, i.image_rating, i.image_hits, c.cat_name, u.user_name, u.user_email FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_id = 2 AND i.image_active = 1 AND c.cat_id = i.cat_id
Unknown column 'c.multi_downloadage_votes' in 'field list'

Warning: Cannot modify header information - headers already sent by (output started at /home/fun/public_html/includes/db_mysql.php:190) in /home/fun/public_html/includes/functions.php on line 114

Offline budduke

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • http://www.budduke.com
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #177 on: September 26, 2010, 09:24:06 PM »
@ khansahib,

I am not sure if the warning is a result of the DB error but you whould recheck all the SQL changes that you did for this mod.
I do know that there is no category called 'c.multi_downloadage_votes'
It looks like you may have copy/pasted over something else. I would think it should be 'c.multi_download' and not sure about how the age_votes should look.
Buddy Duke
www.budduke.com

Offline khansahib

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #178 on: September 26, 2010, 09:36:37 PM »
well sir i've installed your mod on fresh copy of 4images 1.7.8
i've checked each and every file 2 times.. nothing wrong with copy paste..

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Multi Size Download of same image [ver 4.3]
« Reply #179 on: September 26, 2010, 10:15:46 PM »
well sir i've installed your mod on fresh copy of 4images 1.7.8
i've checked each and every file 2 times.. nothing wrong with copy paste..
check 3nd time, because you messed up the first change in details.php. Looks like you replaced only part of the line

@budduke:
see, it's hard to explain exactly which step to look at, when there is no numbered steps in the instructions ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)