View Full Version : Customizing <image_width> and <image_height> tags
I recently updated my installation from 1.4.1 to 1.5beta1.
In my previous installation I was able to modify index.php to produce new tags for custom width and height for any image using the codes below.
$image_width = $image_extra['0'];
$image_height = $image_extra['1'];
$image_width_half = $image_width / 2;
$image_height_half = $image_height / 2;
$tpl = str_replace("<IMAGE_WIDTH>",$image_width,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT>",$image_height,$tpl);
$tpl = str_replace("<IMAGE_WIDTH_HALF>",$image_width_half,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT_HALF>",$image_height_half,$tpl);
The new tags would return half of dimension values which I use to create custom navigation styles for my template. (clicking on left side of the image for previous pic and right side for next photo).
However this has ceased to function when I tried to do it to 1.5beta1's index.php and I have this error on my photoblog
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/acid/public_html/fotolog/index.php on line 784
Please advise :confused:
blinking8s
03-17-2006, 09:06 PM
humm...i modified mine for custome width/height off the image dimensions to place registration marks and such. I cant remember what I did off the top of my head, I'll edit this or post back when i get home...it worked fine between 1.3 and 1.5 beta though
well, at the meantime i've reverted back to using index.php from my backed-up 1.4.1 installation. I do not know if there are any conflicts with the current 1.5Beta1 installation but I have not experienced any yet.
in the meantime, i've continued using the aforementioned code and similar ones to that with a few other modificiations in index.php and it appears to be running fine. i have not yet thoroughly tested the installation for bugs.
the photoblog is currently undergoing some changes but you can still see the progress here http://acidtripping.com/fotolog
just to give you a better picture of what i'm trying to accomplish.
se.nsuo.us
03-18-2006, 05:11 AM
Nice effect! It would be great if you can share it with the community :)
Also - one improvement could be - not showing the respective page curl if you are at the first or last picture
thanks. but i have to take it down again due to the incessant spamming i've been getting. it's getting spammed every single minute! it really is getting on my nerves. any advice?
blinking8s
03-18-2006, 06:55 AM
can you zip up your index and template, we cant really tell whats going wrong from here
upgrading to 1.5 and adding the captcha anti-spam addon will help with spam
please post your php and server information too
can you zip up your index and template, we cant really tell whats going wrong from here
upgrading to 1.5 and adding the captcha anti-spam addon will help with spam
please post your php and server information too
PHP-version 4.4.2
Server software Apache/1.3.34 (Unix) mod_gzip/1.3.26.1a mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_ssl/2.8.25 OpenSSL/0.9.7a PHP-CGI/0.1b
i actually have 1.5 installed, but i replaced the index.php file with my 1.4.1 index.php file because the codes (see first post) i inserted into 1.5's index.php would not work. that!, is my problem. :(
Connie
03-18-2006, 08:10 AM
I do not recommend to let the browser re-size the images.
This always results in bad quality
and what is the reason for resizing after uploading?
just for my understanding: if you know that you want to show the images halfsize, why don't you resize them with a real image-processor and rely on the worse browser functionality to resize?
I also do not recommend to edit the index.php
you ran into the classic trap: after upgrading the hack is not working anymore
for this we now have admin-addons which you can use
by this you still have a solid program and your addon is not touched by any upgrades
and: the energy of developers and supporters will not be not wasted by problems like this!
We do not recommend to edit the index.php, we do not recommend hacks, we do not want to fix hacks here, we have admin-addons for that! :mad:
blinking8s
03-18-2006, 10:52 AM
Well, he's not really resizing the image, he's getting the wdith of half the image for the hit zone, and for two small tags such as there having a few lines of code isnt a really a big deal, the issue lies when things are actually altered in index.php and problems get really hard to figure out. If these dont work in the index, they wont work in an addon either
I am only creating a few more tags to provide more flexibility and customizability so i could create more dynamic templates (sort of). i'm sure a lot of users would like their templates to change according to image sizes. not all images are published at the exact width and/or height. many templates look like crap when you exceed a certain width.
I do not recommend to let the browser re-size the images.
This always results in bad quality
and what is the reason for resizing after uploading?
just for my understanding: if you know that you want to show the images halfsize, why don't you resize them with a real image-processor and rely on the worse browser functionality to resize?
I also do not recommend to edit the index.php
you ran into the classic trap: after upgrading the hack is not working anymore
for this we now have admin-addons which you can use
by this you still have a solid program and your addon is not touched by any upgrades
and: the energy of developers and supporters will not be not wasted by problems like this!
We do not recommend to edit the index.php, we do not recommend hacks, we do not want to fix hacks here, we have admin-addons for that! :mad:
Joe[y]
03-18-2006, 09:07 PM
i copied and pasted your mod and it worked just fine for my photoblog running 1.5beta. perhaps you should try removing the spaces around / . so...
$image_width = $image_extra['0'];
$image_height = $image_extra['1'];
$image_width_half = $image_width/2;
$image_height_half = $image_height/2;
$tpl = str_replace("<IMAGE_WIDTH>",$image_width,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT>",$image_height,$tpl);
$tpl = str_replace("<IMAGE_WIDTH_HALF>",$image_width_half,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT_HALF>",$image_height_half,$tpl);
I've already tried that, removing all the spaces between mathematical operators. It still wouldn't work.
']i copied and pasted your mod and it worked just fine for my photoblog running 1.5beta. perhaps you should try removing the spaces around / . so...
$image_width = $image_extra['0'];
$image_height = $image_extra['1'];
$image_width_half = $image_width/2;
$image_height_half = $image_height/2;
$tpl = str_replace("<IMAGE_WIDTH>",$image_width,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT>",$image_height,$tpl);
$tpl = str_replace("<IMAGE_WIDTH_HALF>",$image_width_half,$tpl);
$tpl = str_replace("<IMAGE_HEIGHT_HALF>",$image_height_half,$tpl);
it's okay guys.
i downloaded a freshcopy of 1.5beta1 and re-edited everything again. it actually works fine. the codes must've gotten screwed up when I used FrontPage2003 to work on it. sorry for the uncessary trouble.
blinking8s
03-19-2006, 01:33 PM
ah, the curse of front page...that program is the devil
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.